How to use a bookmark and a button to show & hide visuals (and other bookmark magic tricks).

How to use a bookmark and a button to show & hide visuals (and other bookmark magic tricks).

Button to hide a simple object.

Getting a simple bookmark button pair working together is easy in Power BI. Here is how you do it.

In this we discuss how to use,

  • Button to show and hide a square object

  • Button to show and hide a Chart Visual

Let's try with a simple object and a button. When the user clicks the button, the square object hides and when clicked again it appears.

Add 2 buttons and a square to the canvas.

You can use any shape and/or any button to do this.

The click action of 2 buttons should be switched between 2 bookmarks.

one with the object and the other without the object.

let's create 2 bookmarks first.

go to View >> Enable Bookmark Pane.

Click Add to create 2 new bookmarks and rename them.

Select Squre_On bookmark >> right click >> Update.

By doing that you assign a current view of the canvas to the bookmark.

In this case, the current state of the canvas is Squre Visible and Buttons Visible.

go to View >> Enable Bookmark Pane.

Select Squre_Off bookmark >> right click >> Update.

The current state of the canvas, Square Hidden and 2 Button Visible is assigned to this bookmark.

Let's assign button actions.

Select Hide Square Button. Enable Action. Select Bookmark on Type.

On the bookmarks dropdown, select the Squre_Off bookmark you want to switch to.

Select Show Square Button. Enable Action. Select Bookmark on Type.

On the bookmarks dropdown, select the Squre_Off bookmark.

Here are the buttons in action.

Button to show and hide a Chart Visual

Let's move on to the next step. In this, we are going to use a simple chart and a square with 2 buttons, one to show the chart and one to hide the chart behind the square.

To do that we need a simple chart visual.

Now that we have 2 bookmarks, to hide object and show object, what we are aiming to do here is to place the chart on the bookmark where the square is no visible. Then the 2 bookmarks switched by the buttons, we can see as if the cart is hidden by the square.

add the chart on to the canvas. At this state the chart is visible on both bookmarks so when we switch bookmarks it looks wired.

Select Squere_On bookmark and hide the chart on it and update the bookmark.

💡
if these pages are not visible, go to View >> Bookmark or View >> Selection.

No changes needed for Squre_Off.

Try clicking on 2 buttons.

How to keep filters when changing bookmarks.

One characteristic of bookmarks is bookmarks do not respect any changes we make in the other bookmarks. The bookmark switching mechanism we created previously was basically a reset button to each bookmark.

Let's add a slicer to the mix and see if it's true.

In this page whenever I switch between bookmarks using 2 buttons, the slicer selection is wiped out.

Let's check how to keep the filter unchanged when switching bookmarks.

Go to Bookmarks Pane.

Bookmark Squre_Off >> Uncheck Data.

Bookmark Squre_On >> Uncheck Data.

Let's check again toggling between 2 bookmarks with a filter.

Conclusion

working with power bi bookmarks is easy when you have some understanding of the functioning of the bookmarks. With some creativity you can do many wonderful things with it.