The CROSSJOIN function returns a table made up of the Cartesian product of all the rows in all the tables included as arguments.
CROSSJOIN(
table,
table
[, table...]
)
- table: Reference to an existing table or DAX expression that returns a table.
The CROSSJOIN function returns a table.
The columns of the result table are all the columns present in the tables included as arguments.
The column names must all be different or the function will return an error.
The number of rows contained in the result table will be equal to the product of the number of rows in all the tables.
If we start from the following tables, Table1:
Table2:
and Table3:
We can create a table with the Cartesian product of the rows of Table1 and Table2 with the following DAX expression:
crossjoin = CROSSJOIN(Table1, Table2)
The number of rows in the resulting table (6) matches the product of the number of rows in Table1 (3) and the number of rows in Table2 (2).
To create a table with the Cartesian product of the rows of the three previous tables we would have to use the following DAX expression:
crossjoin = CROSSJOIN(Table1, Table2, Table3)