CROSSJOIN DAX Function (Table manipulation)

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


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.


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.

» 3 related articles
» 2 related functions


--  CROSSJOIN performs the cartesian product of two tables, 
--  generating all the possible combinations of table rows
        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.
VAR Top5Colors =
    TOPN ( 5, VALUES ( 'Product'[Color] ), [Sales Amount] )
VAR CategoriesWithoutTop5Colors =
    FILTER (
        CROSSJOIN ( VALUES ( 'Product'[Category] ), Top5Colors ),
        CALCULATE ( ISEMPTY ( 'Product' ) )

Category Color
TV and Video Blue
Cell phones Blue
Audio Grey
TV and Video Grey

Related articles

Learn more about CROSSJOIN in the following articles:

Related functions

Other related functions are:

Last update: Jun 13, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation:

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

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.


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


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


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.


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.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.