Clicking buttons is a common action in most apps, and most end users know what a button means and how to use it. Designers can add buttons to a report in Microsoft Power BI to perform simple actions. For instance, you might drop in buttons that display additional insight into the data. Or you might add buttons that provide quick navigation to end users.
In this tutorial, I’ll introduce you to buttons in Microsoft Power BI by inserting two buttons into a two-page report. The button on Page 1 will move to Page 2, and the button on Page 2 will move to Page 1. Implementation is quick and easy. There are other ways to navigate from page to page, but a button is quick and obvious.
SEE: How to build reports in Microsoft Power BI (TechRepublic)
I’m using Power BI Desktop on a Windows 10 64-bit system, but you can also use Power BI Service. You can download the demonstration .pbix file, AdventureWorks Sales from GitHub. Once downloaded, double-click the .pbix file to open it in Power BI and follow along or use a .pbix file of your own. If you want a sneak peek at the final results, check out this demo file.
How to insert a button in Power BI
Buttons in Power BI are a simple user interface control that lets the designer create user-friendly reports. End consumers will usually click a button to interact with the report content in some way. The result is a report that acts more like an app.
Inserting a button is easy. First, click the Insert tab. Then, select Buttons, and choose a button from the dropdown (Figure A). It’s that easy.
That’s the easy part. If you’re familiar with Microsoft 365 apps, you may notice that there are more “buttons” than the ordinary rectangular button that you’re used to seeing. Shapes are available as well. Now, let’s move on and create a button that has a job to do.
How to assign an action to a button in Power BI
Power BI reports often comprise multiple pages, which is a good opportunity to introduce buttons. Specifically, as the designer, you might add buttons that allow users to quickly navigate between pages. You could also use page and bookmark navigators for this task, but buttons are familiar to everyone and offer the user a choice as to when or even if they navigate to another page.
Figure B shows two pages of a simple report. We’ll insert an arrow button to each page that when clicked accesses the other page.
First, let’s insert a button to Page 1. Click the Insert tab. Then, select Buttons, and choose a right-arrow from the dropdown. Drag the arrow to the top-right corner of Page 1 using Figure C as a guide.
Let’s make the button a bit larger so it stands out. If necessary, expand the Format pane. Then, click the General menu, and expand Properties. Click the Lock Aspect Ratio to enable this feature, and change the Height and Width properties to 100 (Figure D).
Now that the arrow is more visible, let’s give it a navigation task. Click the Button menu, and expand the Action section. Enable the Action section, if necessary, by clicking the Off/On button. From the Type dropdown, choose Page Navigation. Then, from the Destination dropdown, choose Page 2 (Figure E).
For this example, turn the ScreenTips option off. However, you could add “Go to page 2,” if you wanted. If you leave this option enabled, but enter no message, Power BI will display a default ScreenTip. Repeat the above process for Page 2, but use the left arrow instead, and choose Page 1 from the Destination dropdown (Figure F).
When published, the two buttons will work as navigation buttons.
How to publish a report in Power BI
Until you publish the report, the buttons won’t work, so click Publish, and click Save when prompted. Then, click the link to the published report when offered. At this point, if you’re not signed into your Microsoft account, you will need to sign in when prompted.
Once published, users can click the right arrow on Page 1, shown in Figure G, to accessPage 2.
Figure H shows the left arrow that users can click to return to Page 1.
Why use buttons in Power BI?
You might be wondering why the designer would add navigation arrows when the user can use the links in the Pages pane. Most importantly, this was a simple introduction to the use of buttons that perform actions in a published report. Second, the Pages pane may not be available to all users.
This demonstration is simple on purpose, but you can see how quickly and easily it is to add buttons that are familiar to users. Everyone knows what a right and left arrow means. On the other hand, you could insert buttons that display the text “Go to page 1” and “Go to page 2.”
We added two simple buttons to navigate between two pages, but you can use a conditional button instead. In a future article, I’ll show you how to use one button that knows what page you’re on and returns to the other page when clicked.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays