GROUPCROSSAPPLY DAX Function (Filter)

Returns a summary table over a set of groups.

Syntax

GROUPCROSSAPPLY ( <GroupBy_ColumnName> [, <GroupBy_ColumnName> [, … ] ], <FilterTable> [, <FilterTable> [, … ] ] [, <Name>, <Expression> [, … ] ] )
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 representing the column name to use for the subsequent expression specified.

Expression
By Expression
Repeatable

Any DAX expression that returns a single value (not a table).

Return values

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

A table which includes combinations of values from the supplied columns based on the grouping specified. Only rows for which at least one of the supplied expressions return a non-blank value are included in the table returned. If all expressions evaluate to BLANK/NULL for a row, that row is not included in the table returned.

Remarks

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

GROUPCROSSAPPLY is similar to SUMMARIZECOLUMNS function, but it does not apply implicit autoexist. All FilterTable parameters are cross-join. FILTERCLUSTER function can be used to perform natural joins of filter tables or group by columns if needed.

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

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

GROUPCROSSAPPLY returns all the combinations of the values in the FilterTable arguments, also if a combination does not exist in the model. Then, it removes the rows where all the expressions return BLANK. If there are no Name and Expression arguments, GROUPCROSSAPPLY returns all the combinations. If there are no GroupBy_ColumnName arguments, GROUPCROSSAPPLY returns one row.

The filter context of the GROUPCROSSAPPLY call also applies to the expressions.

» 1 related article
» 8 related functions

Examples

-- GROUPCROSSAPPLY does not apply autoexist. It returns all the
-- combinations of the values in the filter tables (a cross join),
-- also when a combination does not exist in Product.
-- Each GroupBy column must be in one of the filter tables.
-- The first query has 4 rows: + 0 makes the expression never BLANK.
-- The second query removes the rows where all the expressions are BLANK.
-- SUMMARIZECOLUMNS in the third query applies autoexist,
-- so it returns only the 2 combinations that exist, even with + 0.
EVALUATE
GROUPCROSSAPPLY (
    'Product'[Color],
    'Product'[Brand],
    TREATAS ( { "Red", "Azure" }, 'Product'[Color] ),
    TREATAS ( { "Contoso", "A. Datum" }, 'Product'[Brand] ),
    "Products", COUNTROWS ( 'Product' ) + 0
)
ORDER BY
    'Product'[Color],
    'Product'[Brand]

EVALUATE
GROUPCROSSAPPLY (
    'Product'[Color],
    'Product'[Brand],
    TREATAS ( { "Red", "Azure" }, 'Product'[Color] ),
    TREATAS ( { "Contoso", "A. Datum" }, 'Product'[Brand] ),
    "Products", COUNTROWS ( 'Product' )
)
ORDER BY
    'Product'[Color],
    'Product'[Brand]

EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Color],
    'Product'[Brand],
    TREATAS ( { "Red", "Azure" }, 'Product'[Color] ),
    TREATAS ( { "Contoso", "A. Datum" }, 'Product'[Brand] ),
    "Products", COUNTROWS ( 'Product' ) + 0
)
ORDER BY
    'Product'[Color],
    'Product'[Brand]
Color Brand Products
Azure A. Datum 14
Azure Contoso 0
Red A. Datum 0
Red Contoso 36
Color Brand Products
Azure A. Datum 14
Red Contoso 36
Color Brand Products
Azure A. Datum 14
Red Contoso 36

Related articles

Learn more about GROUPCROSSAPPLY 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 24, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/en-us/dax/groupcrossapply-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 GROUPCROSSAPPLY? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.