
上QQ阅读APP看书,第一时间看更新
CROSSFILTER() Measure
- Create a DAX measure that applies an alternative cross filter behavior to the relationship in the model:
Product Table Rows (CF) = CALCULATE([Product Table Rows],
CROSSFILTER('Internet Sales'[ProductKey],'Product'[ProductKey],OneWay) )
- The measure (Product Table Rows (CF)) overrides the bi-directional relationship to apply single-direction cross filtering.

Single direction CROSSFILTER() measure relative to standard measure with bi-directional model relationship
- Though limited to specific measures, CROSSFILTER() can provide a simple and powerful supplement to the relationship cross filtering defined in the model.
The cross filter direction should be set to Single for the large majority of relationships and particularly dimension-to-fact-table relationships. Bidirectional relationships are very useful with bridge tables and many-to-many relationships. See the Building Analytics into data models with DAX recipe later in this chapter for an example of using bridge tables and bidirectional relationships to support Budget versus Actual reporting. Additionally, bidirectional relationships can be used for dynamic (user specific) Row-level security models - see Chapter 8, Implementing Dynamic User-Based Visibility in Power BI for examples of these implementations.
- Write a DAX measure to propagate filter context.
- The following measure respects the filters applied to the Internet Sales table, such as Customer Gender = "M":
Product Rows (Sales) = CALCULATE(COUNTROWS('Product'),'Internet Sales')
- The Product Rows (Sales) measure returns the same 158 row count as the bidirectional relationship example.