OpenBI Docs Buy

CROSSJOIN

Every combination of the rows of two or more tables.

Group: Table manipulation. Compatible with DAX.

Syntax

CROSSJOIN ( <table1>, <table2> [, <table>] … )
ParameterTypeDescription
table1TableThe first table.
table2TableThe second table.
tableTable
optional, repeatable
Further tables, each multiplying the rows again.

Returns

Table. Every row of the first table paired with every row of the second (and of the next), with the columns of all of them.

Remarks

  • The number of rows is the product of the tables' row counts: 4 products and 16 places make 64 rows. One empty table makes the result empty.
  • Two columns of the same name are an error. Tables written in the query need different column names; rename one with SELECTCOLUMNS.
  • It does not look at the data, so it lists combinations that never occur. For the ones that do, use SUMMARIZE or SUMMARIZECOLUMNS.
  • Model columns stay tied to the model, so a CROSSJOIN of column values works as a filter of combinations in CALCULATE.

Examples

Every size for every product

EVALUATE
CROSSJOIN (
    DATATABLE ( "Size", STRING, { { "33 cl" }, { "50 cl" } } ),
    DATATABLE ( "Product", STRING, { { "Pils" }, { "IPA" }, { "Stout" } } )
)
ORDER BY [Product], [Size]
SizeProduct
33 clIPA
50 clIPA
33 clPils
50 clPils
33 clStout
50 clStout

Combinations that never occur

Depots sell nothing, yet CROSSJOIN pairs them with both categories.

EVALUATE
CROSSJOIN ( VALUES ( Products[Category] ), VALUES ( Places[Kind] ) )
ORDER BY Products[Category], Places[Kind]
Products[Category]Places[Kind]
BeerDepot
BeerShop
CiderDepot
CiderShop

GENERATE, SUMMARIZE, NATURALINNERJOIN, UNION, SUMMARIZECOLUMNS.

Last updated · OpenBI Studio 0.3.74