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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

6 REPLIES 6
avishek_g
Regular 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.

 

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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