# CROSSJOINDAX Function (Table manipulation)

Returns a table that is a crossjoin of the specified tables.

## Syntax

CROSSJOIN ( <Table> [, <Table> [, … ] ] )
Parameter Attributes Description
Table Repeatable

A table that will participate in the crossjoin.

## Return values

Table An entire table or a table with one or more columns.

A table that contains the Cartesian product of all rows from all tables in the arguments.

## Remarks

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.

» 1 related article
» 2 related functions

## Examples

```--  CROSSJOIN performs the cartesian product of two tables,
--  generating all the possible combinations of table rows
EVALUATE
CALCULATETABLE (
CROSSJOIN (
VALUES ( 'Product'[Color] ),
VALUES ( 'Product'[Category] )
),
"#Prods", CALCULATE ( COUNTROWS ( 'Product' ) )
),
'Product'[Category] IN { "TV and Video", "Computers" }
)
ORDER BY [Category], [Color]

```
Color Category #Prods
Black Computers 194
Blue Computers 20
Brown Computers 11
Gold Computers 4
Green Computers 15
Grey Computers 70
Orange Computers 2
Pink Computers 4
Red Computers 15
Silver Computers 78
White Computers 188
Yellow Computers 5
Black TV and Video 72
Blue TV and Video (Blank)
Brown TV and Video 53
Gold TV and Video (Blank)
Green TV and Video (Blank)
Grey TV and Video (Blank)
Orange TV and Video (Blank)
Pink TV and Video (Blank)
Red TV and Video (Blank)
Silver TV and Video 71
White TV and Video 26
Yellow TV and Video (Blank)
```--  CROSSJOIN is useful to find non-existing combinations
--  that might be interesting to further analyze.
DEFINE
VAR Top5Colors =
TOPN ( 5, VALUES ( 'Product'[Color] ), [Sales Amount] )
VAR CategoriesWithoutTop5Colors =
FILTER (
CROSSJOIN ( VALUES ( 'Product'[Category] ), Top5Colors ),
CALCULATE ( ISEMPTY ( 'Product' ) )
)

EVALUATE
CategoriesWithoutTop5Colors

EVALUATE
Top5Colors
```
Category Color
TV and Video Blue
Cell phones Blue
Audio Grey
TV and Video Grey
Color
Blue
Grey
White
Silver
Black

## Related functions

Other related functions are:

Last update: Sep 14, 2023     » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/crossjoin-function-dax

# Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

# Row Context

This expression is executed in a Row Context. Click to read more.

# Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

# Not recommended

The use of this parameter is not recommended.

# Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

# Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

# Deprecated

This parameter is deprecated and its use is not recommended.

# DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

### Contribute

Want to improve the content of CROSSJOIN? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.