Introduction
In this article, you will learn how to create a button and how to use it in Power BI reports. In a Power BI report, you can add different types of buttons, as shown in the below image.
In this article, I will create a button using a bookmark. A bookmark is a very useful feature of Power BI. Using a bookmark, you can capture the current view of a report including filters and visuals used in the report. Whatever you configured in a bookmark you can get it by selecting the saved bookmark. You can also create a collection of bookmarks and arranged them in any order. To create a button with a bookmark, you need to create a bookmark first. To create a bookmark, go to the ‘View’ tab of the Power BI desktop and click on Bookmarks.
When you create a bookmark, the below elements are saved with the bookmark:
- The current state of the report/page
- Applied Filters
- Slicers, including slicer type (for example, dropdown or list) and slicer state
- Visual selection state (such as cross-highlight filters)
- Sort order
- Drill location
- Visibility of an object (by using the Selection pane)
- The focus or Spotlight modes of any visible object
I am going to create a report using the ‘Employee’ table and ‘Department’ table. I have already imported the data from these two tables. I want to create a report where I can check the data in the table by clicking on a button. I will create 3 or 4 buttons according to the department name. Once I click on the ‘MKT’ button, I will get data of employees of the MKT department. Similarly, if I click on another button that represents the second department, I will get the data accordingly. See the below steps to perform this task.
Step 1
Import your data from the source. I have loaded two tables. See the below image
See the data of employee table and Department table.
See the relationship between these two tables.
Step 2
Select table visual and data from these two tables. As we see a relationship between these two tables, we can select the column from both tables in a single visual. See the below image.
Now, I will add a filter on the department name and create a bookmark for each department. For example, first I will apply a filter for the ‘MKT’ department. See the below image.
Now create a bookmark on it. Go to the ‘view’ tab and click on ‘Bookmark’. When you click on ‘add’, a bookmark will be created with the default name ‘Bookmark 1’. You can rename it by double clicking on it.
Similarly, by changing the filter you can add other bookmarks according to the department name. I have added five such bookmarks. To view these bookmarks you can click on ‘View’.
Step 3
Now I am creating the buttons using these bookmarks. To add a button, go to the ‘Insert’ tab and click on the drop-down ‘Button’ option. Select ‘Bookmark’.
A button will be added to your report. Rearrange the position according to your requirement by simply dragging and dropping. Give the name of the button by ‘button text’. Also, you can change the font color, background color, and alignment, etc.
Go to the ‘Action’ and Bookmark as ‘MKT’.
Your button will be created and once you click on it with ‘Ctrl’ (Ctrl+Click on the button) it will work and will show the data of the ‘MKT” department.
Similarly, you can add more buttons to your report. I have added all five buttons according to my different department names.
If you want to remove the bookmark sign from the button, you can set the ‘Shape’ as blank from the ‘Icon’ activity.
Summary
I hope you understood how to create a button using a bookmark. This is a very useful task to add a button in reports. Thanks for reading.