GROUPCROSSAPPLYTABLE DAX Function (Filter)

Returns a summary table over a set of groups.

Syntax

GROUPCROSSAPPLY ( <GroupBy_ColumnName> [, <GroupBy_ColumnName> [, … ] ], <FilterTable> [, <FilterTable> [, … ] ] [, <Name>, <TableExpression> [, … ] ] )
Parameter Attributes Description
GroupBy_ColumnName Repeatable

A fully qualified column reference (Table[Column]) to a base table for which the distinct values are included in the returned table.

FilterTable Repeatable

A table expression which is added to the filter context of all columns specified as GroupBy_ColumnName arguments.

Name Repeatable

A string literal which serves no purpose other than separating FilterTable parameter with TableExpression parameter.

TableExpression Repeatable

A table expression that is evaluated under filter context of filterTable parameters and returned as a part of the join in the return value

Return values

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

A table with the GroupBy_ColumnName columns and the columns of TableExpression. Each combination of GroupBy_ColumnName values has one row for each row that TableExpression returns for that combination.

Remarks

This function is mainly used internally by Power BI to query remote models in composite models.

GROUPCROSSAPPLYTABLE is similar to the GROUPCROSSAPPLY function. All FilterTable parameters are cross-join. FILTERCLUSTER function can be used to perform natural joins of filter tables or group by columns if needed.

The table expression parameter is evaluated in the filter context containing all FilterTable parameters.

You can modify filtering behavior of FilterTable by using the following functions: ALLSELECTEDAPPLY, ALLSELECTEDREMOVE, ALWAYSAPPLY, KEEPFILTERS, SHADOWCLUSTER, NONFILTER.

GROUPCROSSAPPLYTABLE requires one Name and one TableExpression as the last two arguments. Without them, or with a second pair of Name and TableExpression, GROUPCROSSAPPLYTABLE returns an error.

Each GroupBy_ColumnName must be a column of a FilterTable argument. Otherwise, GROUPCROSSAPPLYTABLE returns an error.

For each combination of the values in the FilterTable arguments, GROUPCROSSAPPLYTABLE evaluates TableExpression in the filter context of that combination. The result has one row for each row that TableExpression returns. If TableExpression returns an empty table for a combination, that combination is not in the result. A row of TableExpression with BLANK values stays in the result. This is different from GROUPCROSSAPPLY, which removes the rows where all the expressions return BLANK.

If there are no GroupBy_ColumnName arguments, GROUPCROSSAPPLYTABLE returns the rows of TableExpression one time.

The filter context of the GROUPCROSSAPPLYTABLE call also applies to TableExpression.

» 1 related article
» 7 related functions

Examples

-- GROUPCROSSAPPLYTABLE evaluates the table expression for each
-- combination of the GroupBy columns, in the filter context of that
-- combination. The result has one row for each row of the table
-- expression. The first query returns the brands with 12 or more
-- products for each color: Red has 4 rows, Azure has 1 row.
-- Purple is not in the result, because its table expression is empty.
-- In the second query the table expression always returns one row,
-- so Purple is in the result even if its value is BLANK.
EVALUATE
GROUPCROSSAPPLYTABLE (
    'Product'[Color],
    TREATAS ( { "Red", "Azure", "Purple" }, 'Product'[Color] ),
    "Brands",
    FILTER (
        ADDCOLUMNS (
            VALUES ( 'Product'[Brand] ),
            "Products", CALCULATE ( COUNTROWS ( 'Product' ) )
        ),
        [Products] >= 12
    )
)
ORDER BY
    'Product'[Color],
    'Product'[Brand]

EVALUATE
GROUPCROSSAPPLYTABLE (
    'Product'[Color],
    TREATAS ( { "Red", "Azure", "Purple" }, 'Product'[Color] ),
    "Brands",
    ROW (
        "Brands with 12+ products",
        COUNTROWS (
            FILTER (
                VALUES ( 'Product'[Brand] ),
                CALCULATE ( COUNTROWS ( 'Product' ) ) >= 12
            )
        )
    )
)
ORDER BY 'Product'[Color]
Color Brand Products
Azure A. Datum 14
Red Contoso 36
Red Fabrikam 12
Red Litware 12
Red Southridge Video 13
Color Brands with 12+ products
Azure 1
Purple (Blank)
Red 4

Related articles

Learn more about GROUPCROSSAPPLYTABLE in the following articles:

  • Using ALLSELECTED in composite models

    Using ALLSELECTED with no arguments in a remote model later used in a composite model might produce unexpected results. In this article we examine the topic and provide the reasons why ALLSELECTED requires special attention. » Read more

Related functions

Other related functions are:

Last update: Nov 25, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/en-us/dax/groupcrossapplytable-function-dax

2018-2026 © 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.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

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 GROUPCROSSAPPLYTABLE? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.