## How does the CROSSJOIN function (DAX) work?

The CROSSJOIN function (DAX) returns a table that contains the Cartesian product of all rows from all tables in the arguments. The columns in the new table are all the columns in all the argument tables.

## CROSSJOIN Formula Syntax

CROSSJOIN(
<table>, <table>[, <table>]…
)

## How do you use the CROSSJOIN function?

Used CROSSJOIN when you wish to create combination of every row from two tables.  All row combinations are included in the result; this is commonly called cross product join.  A common use for a cross join is to create obtain all combinations of items, such as colors and sizes.

## Related Support Forum Posts

Budgeting using crossjoin
Finding the closet group of friends in classroom

## Considerations when using the CROSSJOIN function

• Column names from table arguments must all be different in all tables or an error is returned.
• The total number of rows returned by CROSSJOIN() is equal to the product of the number of rows from all tables in the arguments; also, the total number of columns in the result table is the sum of the number of columns in all tables. For example, if TableA has rA rows and cA columns, and TableB has rB rows and cB columns, and TableC has rC rows and cC column; then, the resulting table has rA × rb × rC rows and cA + cB + cC columns.

## Formula examples using the CROSSJOIN function

CROSSJOIN( Colors, Stationery)

= CROSSJOIN (Salesperson,Products)

CrossJoin({[Qtr1], [Qtr2], [Qtr3]}, {[New York], [California], [Texas]})