Forum Discussion
Measure filter ignoring established relationships?
- 6 years ago
Hi Anonymous ,
For the sceanario, I think you need to understand about context of DAX. Regarding measures, it might be affected by the row context. So the result may not be the same when you put it into the charts that contains different columns. And if you use Calculate and Filter, the filter context will be changed to the content that you writed in filter().
Perhaps you might consider taking some time learning about context. There is a blog that you can reference firstly.
https://www.sqlbi.com/articles/row-context-and-filter-context-in-dax/
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
To further complicate things I tried adding a slicer on 'ID'[ID] and limiting it to 6. Apparently the measure was affected but not the matrix. I checked that they are linked (has interactions enabled).
I've come to the temporary conclusion that using FILTER inside CALCULATION, such as the above measure, forces a filtering relationship with direction of "Both" - even though no such relationship has been established between the tables. Please do correct me if I'm wrong!
Wrapping the measure in a CALCULATE function and CROSSFILTER with direction "none" set as the expression (or just adding it to the original CALCULATION expression in this case also works) yields the same result as the matrix:
Total sales items with relations = CALCULATE(CALCULATE(sum(Sales[Value]);filter(Items;Items[NumberOfRelated]>0)); CROSSFILTER(Sales[ID];'ID'[ID];None) )
- v-xuding-msft6 years agoCommunity Support
Hi Anonymous ,
For the sceanario, I think you need to understand about context of DAX. Regarding measures, it might be affected by the row context. So the result may not be the same when you put it into the charts that contains different columns. And if you use Calculate and Filter, the filter context will be changed to the content that you writed in filter().
Perhaps you might consider taking some time learning about context. There is a blog that you can reference firstly.
https://www.sqlbi.com/articles/row-context-and-filter-context-in-dax/
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.