How to generate combinations for Attribute-Based Calculation Matrices (Vlocity)

Generating al the possible combinations for Attribute-based pricing Calculation Matrices can be a hassle. But it’s worth it and this allows the cart to show the right price when you add Products, despite the original pricing.

Combinations for Attribute-based

Generating combinations for Attribute-Based Pricing

There’s more than one way to generate permutations, besides just doing it manually.

Two columns spreadsheet formula

=INDEX(FLATTEN(A2:A3&" "&TRANSPOSE(B2:B4)))

But, this only works for small datasets and only two columns.

calculation matrices for vlocity attribute-based pricing

For three columns:

=INDEX(FLATTEN(FLATTEN(
 FILTER(A2:A; A2:A<>"")&";"&TRANSPOSE(
 FILTER(B2:B; B2:B<>"")))&";"&TRANSPOSE(
 FILTER(C2:C; C2:C<>""))))
Image from original stackoverflow question

For 5 columns

= ARRAYFORMULA(SPLIT( FLATTEN(FLATTEN(FLATTEN(FLATTEN(
 FILTER(B2:B, B2:B<>"")&";"&TRANSPOSE(
 FILTER(C2:C, C2:C<>"")))&";"&TRANSPOSE(
 FILTER(D2:D, D2:D<>"")))&";"&TRANSPOSE(
 FILTER(E2:E, E2:E<>"")))&";"&TRANSPOSE(
 FILTER(F2:F, F2:F<>""))),";"))

Using a free string combination online tool

This nifty website has a simple tool to combine items from two columns. The only caveat is that at the end you’ll have to manually change the Space between the items for semicolons (;) or add them if you chose the No Space option.

This option works well if you don’t have an extensive list.

Was this article helpful?
YesNo