cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors