I love magic. One of my favorite acts is making an object disappear and replace it with something or someone else. I can’t do magic on a stage, but I can tell you how to do it in a Power BI report.
The previous article covers how to add a bookmark in a Power BI report and assign it to a Power BI element like a button or a shape. This article covers how we can use bookmarks along with the Selection pane to enhance the user’s experience in simple steps.
Setting up the stage: Adding all the visuals
We have created two sets of visuals, each containing a button and a card.
We place them on the top of each other
Tip: Rename the visuals as you add them in the report in the Selection Pane (double click – Rename). It becomes easy to identify.
Adding the Trick: Selection Pane
For our magic trick to work, we need to show one card and one button at a time. For this act, if we are showing the card for the absolute value of the Margin, then the button for Margin % should be visible, and vice versa.
View one: Margin (absolute)
Adding the bookmark
Once we configure the view, add a bookmark for this visual:
We name it as Margin Absolute as it is showing the absolute value of the Margin
Click Option > Uncheck the Data option.
It ensures that this bookmark saves only the visual’s display state and not the filter settings of the page.
View Two: Margin%
Repeat the steps for the other two visuals and add a bookmark.
Final Touch: Assign Bookmarks to the button
The objective is that if we click on button Margin Absolute, it should show the card visual for margin absolute and button for Margin %, and vice versa. It enables the toggle between the two sets of the visuals.
For more details on assigning a bookmark to a button or image, refer to the following article:
Repeat the steps for the Margin% button.
Note: In Power BI Desktop, use the CTRL key along with the mouse click for a button to work.