Forum Discussion
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
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.
3. Change the Font and Background color for Category slicer, and make it transparent when 2021 is selected.
4. The final result is as follows, the Category slicer will be hidden when 2021 is selected.Note that make sure to clear the Category slicer selection before selecting 2021, otherwise the following result will be displayed.
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,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
10 Replies
- avishek_gFrequent 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: CurrencyUpdate the "ShowRate" bookmark - while selecting Rate Slicer - visible, currency slicer (selected to global) - visible.
Then update "HideRate" bookmark - while selcting Rate Slicer - imvisible, Curreny Slicer (toggled to Local) - VisibleTick marked to "Data" and "Selected Visuals" for both updation.
Result:
Now upon clicking on the Global button you can show the Rate Slicer
While selecting the Local option in Currency will hide the Rate slicer
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.
- Kishanbhise17New Member
Hi v-kkf-msft The solution works if the slicer is a vertical list ,but it doesn't work with a drop-down slicer with search enabled,the slicer will still remain visible with drop-down and search enabled options. The values formatting doesn't have fx option and that is the causing the problem..
- v-kkf-msft
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.
3. Change the Font and Background color for Category slicer, and make it transparent when 2021 is selected.
4. The final result is as follows, the Category slicer will be hidden when 2021 is selected.Note that make sure to clear the Category slicer selection before selecting 2021, otherwise the following result will be displayed.
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,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Jim_BFrequent Visitor
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?
- Kishanbhise17New Member
Hi winniz, The solution that you provided works fora slicer with vertical list with search option disabled...it doesn't not work with a drop down with search enabled.. tje slicer remains visible when search is enabled with drop-down as the fx options not available for values formatting in a slicer. Is there any custom slicer which allows fx for values formatting as well
- jwbingelRegular Visitor
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!
- ayush_shrmaNew Member
Hi,
Can you please explain the logic of Measure? And why can't we use justMeasure = IF(SELECTEDVALUE ( Dates[Year] ) = 2021,1,0)
- amitchandak
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
- AnonymousNot applicable
Hi Kishanbhise17 Miska AxelllD ayush_shrma avishek_g @
If i follow the above steps it will work for Vertical list slicer
but i need help for dropdown slicer
i have followed the same steps:
i got output when i used vertical list slicer, how to hide for dropdownfine up to here
see next snapshotsCan anyone help me on this