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,
I am surprised this question hasn't come up more - I found a similar post but it didn't the solution didn't work for my situation.
So, I have a PBI report stuffed with measures that look like this:
Total Red Cases = CALCULATE(DISTINCTCOUNT('All Cases'[Case Number]), 'All Cases'[CaseColour] = "Red")
The measures always perform a distinct count on the [Case Number] field, where a particular criteria is true i.e., where the [CaseColour] field is 'Red'
But I have just discovered that the CALCULATE function overrides the page slicers, so when the end user filters out all the red cases, I would expect the value in my measure 'Total Red Cases' to go to zero however, it remains unchanged.
Is there anyway to prevent CALCULATE from overriding the page filters? Or is there a different way to write the DAX to get around this? Any help appreciated
Solved! Go to Solution.
@vickyw ,
I believe the KeepFilters function will help in this situation:
Total Red Cases = CALCULATE(DISTINCTCOUNT('All Cases'[Case Number]),
KEEPFILTERS('All Cases'[CaseColour] = "Red"))
https://learn.microsoft.com/en-us/dax/keepfilters-function-dax
for a completed explanation.
Hope this is what you are aiming for.
Regards,
It absolutely does! Thank you so much!! 😄
@vickyw ,
I believe the KeepFilters function will help in this situation:
Total Red Cases = CALCULATE(DISTINCTCOUNT('All Cases'[Case Number]),
KEEPFILTERS('All Cases'[CaseColour] = "Red"))
https://learn.microsoft.com/en-us/dax/keepfilters-function-dax
for a completed explanation.
Hope this is what you are aiming for.
Regards,
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 |
---|---|
96 | |
93 | |
82 | |
70 | |
64 |
User | Count |
---|---|
116 | |
106 | |
94 | |
79 | |
72 |