In this article we will look at using bookmarks and selection pane logic in conjunction in the Power BI report.
In the Power BI report shown in the screenshot below, I have created a report page ‘Bookmarking’ and it has ‘Sales Amount by Product Category’ visualizations, one as a table visualization, and the other as the bar chart visualization. Data source of this report is the ‘Internet Sales’ data mart of the ‘AdventureWorksDW2017 ’ SQL server database.
Now we will look at controlling the visibility of these two visualizations using three buttons. Buttons should be doing the following:
- ‘Show all visuals’ button – when clicked, shows both the table and bar chart visualizations in the report page
- ‘Table only’ button – when clicked, shows only the table visualization in the report page
- ‘Chart only’ button – when clicked, shows only the bar chart visualization in the report page
Let’s look at the steps involved in doing this.
1) Select the ‘View’ ribbon and enable the ‘Bookmarks pane’ and ‘Selection pane’ boxes.
2) From the ‘Bookmarks’ pane added in the report, click on ‘Add’ to create a new bookmark of the report. Bookmark then stores the current state of the report – in our case, the two dashboards are shown on the report.
3) Rename the newly added bookmark to ‘Show all visuals’.
4) Hide the ‘bar chart’ visual. To do this, click on the eye icon on the right side of the visual. You will then notice the ‘bar chart’ visual disappear from the report canvas.
5) Add a new bookmark and then rename the bookmark to ‘Table visual’.
6) Unhide all the visuals. Click on ‘Show’ on the ‘Selection’ pane. This step will unhide the ‘bar chart’ visual.
7) Hide the ‘Table chart’ visual. To do this, click on the eye icon on the right side of the visual. You will then notice the ‘Table chart’ visual disappear from the report canvas.
8) Add a new bookmark, and then rename the bookmark to ‘Chart visual’.
9) Now create the buttons. To create a new button, select the ‘Home’ ribbon, and then click on Buttons -> Blank to create a new button.
10) Select the newly created button, and then under ‘Visualizations’ pane, make the ‘Button Text’ card to ‘On’, expand it and name ‘Button Text’ to ‘Show all visuals’.
11) Now link the ‘Show all visuals’ bookmark to ‘Show all visuals’ button. To do this, select the ‘Show all visuals’ button and then under ‘Visualizations’ pane, make the ‘Action’ card to ‘On’ and then expand it. Select the Action->Type to ‘Bookmark’ from the drop down, and then select Action->Bookmark to ‘Show all visuals’ bookmark. Now you have successfully linked the bookmark to a button.
12) Repeat the steps 9, 10 and 11 to create two new buttons ‘Table only’ and ‘Chart only’ and then link them to the ‘Table visual’ and ‘Chart Visual’ bookmarks simultaneously.
13) Now, the report looks like the one in the screenshot below. Click (‘Ctrl + click’ on Power BI desktop, just click on Power BI service) on any button, you can see the display of the report changes according to the button’s bookmark mapping.
Hope this post will help you to understand the bookmark and selection pane functionalities in Power BI.