CROSSFILTER DAX Function (Relationships management)

Specifies cross filtering direction to be used in the evaluation of a DAX expression. The relationship is defined by naming, as arguments, the two columns that serve as endpoints.

Syntax

CROSSFILTER ( <LeftColumnName>, <RightColumnName>, <CrossFilterType> )
Parameter Attributes Description
LeftColumnName

Left Column.

RightColumnName

Right Column.

CrossFilterType

The third argument to the CROSSFILTER function should be 0 for None or 1 for OneWay, or 2 for Both. It is also possible to use words None, OneWay, Both.

Return values

The function returns no value. The function only sets the cross-filtering direction for the indicated relationship, for the duration of the query.

Remarks

In the case of a 1:1 relationship, there is no difference between the one and both direction.

CROSSFILTER can only be used in functions that take a filter predicate as an argument, for example: CALCULATE, CALCULATETABLE, CLOSINGBALANCEMONTH, CLOSINGBALANCEQUARTER, CLOSINGBALANCEYEAR, OPENINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR, TOTALMTD, TOTALQTD and TOTALYTD functions.

CROSSFILTER uses existing relationships in the model, identifying relationships by their ending point columns.

In CROSSFILTER, the cross-filtering setting of a relationship is not important; that is, whether the relationship is set to filter one, or both directions in the model does not affect the usage of the function. CROSSFILTER will override any existing cross-filtering setting.

An error is returned if any of the columns named as an argument is not part of a relationship or the arguments belong to different relationships.
If CALCULATE expressions are nested, and more than one CALCULATE expression contains a CROSSFILTER function, then the innermost CROSSFILTER is the one that prevails in case of a conflict or ambiguity.

Related articles

Learn more about CROSSFILTER in the following articles:

  • Many-to-many relationships in Power BI and Excel 2016

    The new DAX available in Excel 2016 and the data model in Power BI and Analysis Services 2016 offer tools to manage many-to-many relationships in a more efficient way than previous version, as described in this article. » Read more

  • Bidirectional relationships and ambiguity in DAX

    Activating bidirectional cross-filter in a Tabular data model might create ambiguous paths in the chain of relationships, resulting in very dangerous models as numbers become unpredictable. This article provides a deep explanation of the kind of ambiguity that might appear… » Read more

Related functions

Other related functions are:

Last update: Nov 21, 2020   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

MSDN documentation: https://docs.microsoft.com/en-us/dax/crossfilter-function

Black Friday
2018-2020 © SQLBI. All rights are reserved. Information coming from MSDN 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.

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.

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 CROSSFILTER? 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.