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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Miska
Helper I
Helper I

Hide/Unhide Slicer based on another slicer values

Hi!

 

I am looking to hide slicer 1 based on values selected on Slicer 2 on my PowerBI report. For example if I select 2021 on slicer 2 I want the Slicer 1 to be hidden or invisible, whereas if I select any other year  on slicer 2 , the slicer 1 should re appear with the values available to choose from. Is this possible to do so by any chnace and if so would really appreciate your help with it.

 

Thanks

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Miska ,

 

Currently it is not possible to make another slicer invisible based on the value in the slicer. But you can hide the slicer by making the value in this slicer empty and the font and background color transparent.


The steps are as follows.


1. Create the following measures.

 

Measure = 
IF (
    SELECTEDVALUE ( Dates[Year] ) = 2021,
    COUNTROWS ( 
        INTERSECT ( 
            VALUES ( 'Table'[Category] ), 
            { BLANK () } 
        ) 
    ),
    COUNTROWS ( VALUES ( 'Table'[Category] ) ) 
)
Color = 
IF (
    SELECTEDVALUE ( Dates[Year] ) = 2021, 
    "#FFFFFF00"
)

 

2. Use Measure to filter the Category field in the slicer.

 

vkkfmsft_0-1640070364541.png

 

3. Change the Font and Background color for Category slicer, and make it transparent when 2021 is selected.


vkkfmsft_1-1640070418069.png       vkkfmsft_2-1640070452615.png


4. The final result is as follows, the Category slicer will be hidden when 2021 is selected. 

 

vkkfmsft_4-1640070506064.png     vkkfmsft_3-1640070486466.png

vkkfmsft_5-1640070551608.png

 

Note that make sure to clear the Category slicer selection before selecting 2021, otherwise the following result will be displayed.

 

vkkfmsft_6-1640070629120.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

7 REPLIES 7
avishek_g
Frequent Visitor

There is no off-the-shelf way in Power BI to control the visibility of a slicer's values dynamically (No *fx* button next to the value font color selection). However, you can show or hide one slicer (slicer 2) based on the selected value of another slicer (slicer 1) by applying the below work around. It's a solution using bookmarks:

Scenario:
I have 2 slicers, Slicer 1, called "Currency" and Slicer 2 called " Rate".
Slicer 1 has 2 options " Global" and "Local".
Slicer 2 has 2 options "Fixed" and "Variable"

Business Requirement:
The need is to give the user the option to select between Fixed and Variable rates when the user selects Global currency.
When the user selects Local currency, the 2nd slicer is irrelevant. Hence it should be hidden.

Solution:
Create 2 bookmarks and name them "ShowRate" and "HideRate"
insert 2 completely transparent rectangles and place them on top of each radio button/switch of "Globa" and "Local" option of slicer 1: Currency

avishek_g_0-1688919645431.png

 

Update the "ShowRate" bookmark - while selecting Rate Slicer - visible, currency slicer (selected to global) - visible.

avishek_g_4-1688919985660.png

 


Then update "HideRate" bookmark - while selcting Rate Slicer - imvisible, Curreny Slicer (toggled to Local) - Visible

 

avishek_g_5-1688920041501.png

 

Tick marked to "Data" and "Selected Visuals" for both updation.

avishek_g_3-1688919923176.png

 

Result:

Now upon clicking on the Global button you can show the Rate Slicer

 

avishek_g_1-1688919819372.png

While selecting the Local option in Currency will hide the Rate slicer

avishek_g_2-1688919876505.png

Point to not that when the user is clicking on the Currency sliceer, it's appearing that they are clicking on the slicer radio button but actually they are clicking two imvisible bookmarks that hide or show the other visual.

v-kkf-msft
Community Support
Community Support

Hi @Miska ,

 

Currently it is not possible to make another slicer invisible based on the value in the slicer. But you can hide the slicer by making the value in this slicer empty and the font and background color transparent.


The steps are as follows.


1. Create the following measures.

 

Measure = 
IF (
    SELECTEDVALUE ( Dates[Year] ) = 2021,
    COUNTROWS ( 
        INTERSECT ( 
            VALUES ( 'Table'[Category] ), 
            { BLANK () } 
        ) 
    ),
    COUNTROWS ( VALUES ( 'Table'[Category] ) ) 
)
Color = 
IF (
    SELECTEDVALUE ( Dates[Year] ) = 2021, 
    "#FFFFFF00"
)

 

2. Use Measure to filter the Category field in the slicer.

 

vkkfmsft_0-1640070364541.png

 

3. Change the Font and Background color for Category slicer, and make it transparent when 2021 is selected.


vkkfmsft_1-1640070418069.png       vkkfmsft_2-1640070452615.png


4. The final result is as follows, the Category slicer will be hidden when 2021 is selected. 

 

vkkfmsft_4-1640070506064.png     vkkfmsft_3-1640070486466.png

vkkfmsft_5-1640070551608.png

 

Note that make sure to clear the Category slicer selection before selecting 2021, otherwise the following result will be displayed.

 

vkkfmsft_6-1640070629120.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

You are a hero

Hi, 
Can you please explain the logic of Measure? And why can't we use just 

Measure  = IF(SELECTEDVALUE ( Dates[Year] ) = 2021,1,0)

 

I'm trying to do the same for a slicer that is configured as a Dropdown.  Your approach works great for a Vertical List slicer with Select All disabled.  I'm not able to figure out a way to hide a Dropdown slicer.  Do you know of anyway to do this? 

Hi @v-kkf-msft Can this be done when we are trying to hide a date filter? I tried this and it doesn't appear to be working. I'm wondering if it's because it's not a text field. Thanks!

amitchandak
Super User
Super User

@Miska , I doubt you can hide slicer based on the value of another slicer, May be you can make font color and background color as transparent

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.