Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
SmithSC
Regular Visitor

How to hide a visual using a slicer

I have a power bi table which contains 4 category columns and a count measure. My power bi page contains 3 dropdown slicers (Category1, Category 2 and Category 3) and 4 column charts.

 

I am trying to hide charts based on the selection of 3 slicers (Category 1, Category 2, Category3). If none of the slicers are selected  then I want Category 1 column chart to show. If a selection is made in the first slicer then I want Category 2 chart to show.

 

To do this, I created 3 measures to test the slicers:

Cat1 Test = IF(ISFILTERED(Data[Category 1]),1,0)
Cat2 Test = IF(ISFILTERED(Data[Category 2]),10,0)
Cat3 Test = IF(ISFILTERED(Data[Category 3]),100,0)
 
I've then created another measure to add the 3 previous together.
Total Test = [Cat1 Test] + [Cat2 Test] + [Cat3 Test]
 
Then another measure works out which chart to show:
See Visual =
    SWITCH(
        TRUE(),
        [Total Test] = 0, "Cat1", -- Show Category 1 Chart
        [Total Test] = 1, "Cat2", -- Show Category 2 Chart
        [Total Test] in {10,11},"Cat3", --Show Category 3 Chart
        [Total Test] in {100,101,110,111},"Cat4", -- Show Category 4 Chart
        BLANK()
    )
 
Finally I put this last measure in the visual filter and selected "is Cat1". This doesn't seem to work and just hides the report.
 
Has anyone any idea what I've done wrong.
 
Many thanks in advance for any help given.
0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.