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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors