Simple Trick to Hide Slicer Items

Video to Hide Slicer Items

Recently, someone posted a question over on the Power BI Community forum. They asked: how can you hide a slicer based on the items selected in another slicer? Here is the link to the original post in the Community. Well, I don’t know if there’s actually a way to hide a slicer, but we can certainly hide slicer items. With conditional formatting, we can also change the colour of the title to “hide” it (make it invisible) as well.

In this blog post, I will demonstrate a trick for how to hide all the items in a slicer. Let’s first understand the requirements. So, we have two slicers. One is to slice the data by year and the other to slice the data by month. There is also another slicer with two options: “By Year” or “By Month.” This means that when a user selects “By Year,” we won’t see the Month slicer and vice versa. See the image below:

To achieve this functionality, as seen in the video at the top of this blog post, we simply need a couple of measures and a visual level filter. Let’s see what these measures are:

Filter by Month = INT ( SELECTEDVALUE ( 'Filter'[Filter] ) = "By Month" )

Filter by Year = INT ( SELECTEDVALUE ( 'Filter'[Filter] ) = "By Year" )

The above measures return a value of 0 or 1, based on the selection. If “By Month” is selected in the slicer, then the Filter by Month measure will return the value 1, or else 0. Similarly, if the “By Year” value is selected, then the Filter by Year measure will return the value 1, or else 0.

We will then use the above measures as a visual level filter, and voila — we have our solution!

Slicer - Filter By Month
By Month – Visual Level Filter
Slicer - Filter By Year
By Year – Visual Level Filter

Recommended Posts

No comment yet, add your voice below!

Add a Comment