Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
This simple CALCULATE measure is testing my fundamental DAX understanding and I would like to draw from your wisdom.
The following screenshot should explain the situation, but I will explain further below:
I have this table:
Code | Category | Period |
1 | A | P1 |
2 | A | P2 |
3 | B | P2 |
4 | C | P1 |
I created a measure: "Count Of P2" to count the number of rows with Period = P2 as follows:
Solved! Go to Solution.
Hi there @MarianoG
This admittedly unintuitive behaviour has do with auto-exist, in particular how it behaves when multiple filters are applied on the same table.
This article explains what's going on better than I could, with a similar example to yours:
https://www.sqlbi.com/articles/understanding-dax-auto-exist/
This behaviour can rear its head when filters are applied on columns of the same table, and you remove one of the filters via DAX with ALL or REMOVEFILTERS. The DAX query that is generated by the visual uses SUMMARIZECOLUMNS, which combines filters on the same table into a single filter, which effectively includes only existing combinations of the columns filtered. Removing the filter on one of the columns via DAX (in this case the Period column) does not remove the effect of the other column (Category) having been limited as a result of the original Period filter.
What can you do about it?
One solution is to move Category and Period to related dimension tables (i.e. create a star schema), and filter on columns in those tables instead.
Regards,
Owen
Thanks Owen!
Great explanation.
Hi there @MarianoG
This admittedly unintuitive behaviour has do with auto-exist, in particular how it behaves when multiple filters are applied on the same table.
This article explains what's going on better than I could, with a similar example to yours:
https://www.sqlbi.com/articles/understanding-dax-auto-exist/
This behaviour can rear its head when filters are applied on columns of the same table, and you remove one of the filters via DAX with ALL or REMOVEFILTERS. The DAX query that is generated by the visual uses SUMMARIZECOLUMNS, which combines filters on the same table into a single filter, which effectively includes only existing combinations of the columns filtered. Removing the filter on one of the columns via DAX (in this case the Period column) does not remove the effect of the other column (Category) having been limited as a result of the original Period filter.
What can you do about it?
One solution is to move Category and Period to related dimension tables (i.e. create a star schema), and filter on columns in those tables instead.
Regards,
Owen
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
14 |
User | Count |
---|---|
42 | |
39 | |
33 | |
19 | |
18 |