Forum Discussion
Hiding Visuals in PowerBI Based on Filter - Help!
- 1 year ago
ABridgeA4
Hi, Your issue likely stems from the wayISFILTERED()interacts with filters and the specific structure of your dataset. Here’s how to troubleshoot and fix it:
Your visual disappears entirely becauseISFILTERED()is returningFALSE, setting the measure to1, and your visual is hidden.Alternative Approach Using
CALCULATEInstead of
ISFILTERED(), try usingALLSELECTED()to detect if any category is actively filtered:
HideClassification =
IF (
COUNTROWS(ALLSELECTED(Latest[Classification Test])) = COUNTROWS(ALL(Latest[Classification Test])),
1, -- Show visual when nothing is filtered
0 -- Hide visual when filtered
)-
Replace
ISFILTERED()withCOUNTROWS(ALLSELECTED(...))method. -
Apply the measure as a filter to your visuals.
-
Ensure the measure is correctly added to the visual if filtering options are disabled.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
-
ABridgeA4
Hi, Your issue likely stems from the way ISFILTERED() interacts with filters and the specific structure of your dataset. Here’s how to troubleshoot and fix it:
Your visual disappears entirely because ISFILTERED() is returning FALSE, setting the measure to 1, and your visual is hidden.
Alternative Approach Using CALCULATE
Instead of ISFILTERED(), try using ALLSELECTED() to detect if any category is actively filtered:
HideClassification =
IF (
COUNTROWS(ALLSELECTED(Latest[Classification Test])) = COUNTROWS(ALL(Latest[Classification Test])),
1, -- Show visual when nothing is filtered
0 -- Hide visual when filtered
)
-
Replace
ISFILTERED()withCOUNTROWS(ALLSELECTED(...))method. -
Apply the measure as a filter to your visuals.
-
Ensure the measure is correctly added to the visual if filtering options are disabled.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Thank you so much, that works! Do you have any idea on how to resolve the other issue where I cannot change what the pie chart is filtered by? The filter is definitely not locked, so I am not sure what the issue is there.