How to build a toggle-able window in PowerBI (even though that's not a feature)
One common UX issue I’ve had when building PowerBI reports is that stakeholders often want a lot of slicers. It makes sense, having a large amount of control over their data is a reasonable request. The only problem is that it tends to visually overload the report. It starts to look visually heavy very fast. In the worst-case scenario, slicers could end up taking up nearly half of your screen real-estate. Usually, you’d hide all these options behind a collapsible/toggleable window.
Unfortunately, PBI doesn’t have such functionality. There’s no built-in way to to create expandable menu’s or modal windows.
But I found a workaround. Here’s how to hack it.
Creating our groups
First, go to View->Selection to open the Selection window. This window shows you all the elements on your page, and in what order they’re shown in (things lower on the list will be shown behind those higher on the list).
In this window, select your slicers, right click, and create a group.
With the new group, you’ll see that you can toggle the visibility of all of them at once by changing the visibility of the group. At this step, you’ll also want to add a box and place it behind the slicers. This will be the “window”.
While we’re here, let’s also add two buttons. A “hide” button and a “show” button. These can stay outside our group. Our Selection window should now look like this:
Our hierarchy is:
- Hide button
- Group
- All the slicers
- our window background (a square shape)
- Show button
Creating our bookmarks
Next, we’ll configure the functionality of the two buttons. Each one should show or hide this group respectively. In the top ribbon, go to the View->Bookmarks tab and create two bookmarks.
In PowerBI, a Bookmark is a shortcut to a certain "state" the report is in.
This includes selections and visibility.
You can use it to quickly link users to specific things you want them to see. E.g., you could have a "bicycle sales for the last fiscal month in Arkansas" bookmark that sets the values of the product, date, and geolocation slicers.
The Show Slicers bookmark should:
- show the group
- show the Hide button
- hide the Show button
The Hide Slicers bookmark should do the inverse:
- hide the group
- hide the Hide button
- show the Show button
For both bookmarks, right click and ensure that it’s only bookmarking the Display and page. Data should be unchecked.
Creating the functionality
Finally, link the buttons to the bookmarks. When we click the button, it will send us to this Bookmark, which controls the visibility of the slicer window (and hides itself and shows the other button).
And here’s our end result: a “window” that we can show and hide to save valuable screen space and keep our reports looking clean.