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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors