Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
123 | |
79 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |