Sub topic 5
Assigning Button Actions
This chapter assumes you can insert a button, move it on the canvas, and create a bookmark in Power BI Desktop. It also assumes you know what the Selection pane does. A button has no behavior until you give it an action. Here you will learn which actions exist, how to configure each one, and where each one fails.
Where actions are set
Select a button, open the Format button pane, and expand Action. Turn the toggle on. Two settings appear: Type and, for most types, a second setting that depends on the type you chose (the bookmark, the destination page, and so on). Each button has one action. If you need two things to happen on one click, put both changes in a single bookmark.
The action runs in Desktop only when you hold Ctrl and click. In the Power BI service, and in reading view, a plain click runs it. A tooltip on the button tells you which action it will run.
The types available are:
| Type | What it does | Typical use |
|---|---|---|
| Back | Returns to the previous page or to the state before a drill-through | Detail pages reached by drill-through |
| Bookmark | Applies a saved bookmark | Show/hide panels, view switching, reset |
| Page navigation | Opens a chosen page | Menus and "next page" links |
| Q&A | Opens the Q&A explorer | Natural-language questions |
| Apply all slicers | Applies slicer changes you have staged | Reports with the **Apply** slicer pause |
| Clear all slicers | Resets every slicer on the report | Clear-filters button |
| Web URL | Opens a link in a new browser tab | Documentation, a source system |
Back
The Back action returns the user to where they came from. It is most useful on a page that users reach through drill-through, because the report remembers the previous page and the filters that were active there.
Insert a button, choose the Back shape (a built-in arrow shape), and the action is already set to Back. You can also use a different shape and set the action by hand.
Two limits apply. First, Back needs a history. If a user opens the page directly from the page tabs, there is nowhere to go back to, and the button does nothing useful. Second, Back does not undo a bookmark. It returns to a page, not to a previous bookmark state.
Bookmark
The Bookmark action applies one bookmark that you pick from a drop-down. The list holds every bookmark in the report. If it is empty, you have not created any yet. Create the bookmark first, then return to the button.
Applying a bookmark restores what that bookmark captured. That depends on its Data, Display, and Current page options, which you set when you create or update the bookmark. If a bookmark has Current page turned off, the button changes the visuals but stays on whichever page the user is viewing. If it has Current page turned on, the button can also switch the page.
Keep these points in mind when you assign the action:
- The button applies a bookmark by its saved state, not by its name. If you rename the bookmark, the button still works. If you delete the bookmark, the action becomes empty and the button does nothing.
- If you update a bookmark later (for example, you move a visual and choose Update), every button that points to it picks up the change.
- A button on a page applies a bookmark to the current report only. It cannot apply a bookmark from another report.
Page navigation
The Page navigation action opens a page of your choice. Set Type to Page navigation, then pick the page under Destination. The list shows every visible page. Hidden pages also appear in the list, which makes this the standard way to reach a hidden detail page.
Some behaviors to know:
- Navigation does not carry slicer selections across pages unless the slicers are synced (View tab, Sync slicers). Filters applied to a visual stay with that visual's page.
- If you rename a page, the button follows it. If you delete the destination page, the button shows an error state and Destination is blank.
- A page the user is not allowed to see in the service (for example, a page hidden by report design) can still be reached by a button. Hiding a page is not a security control.
If your report has many pages, the page navigator visual produces one button per page and keeps itself up to date. A later chapter covers it. For a single link, a button is simpler.
Q&A
The Q&A action opens the Q&A explorer, where a user types a question in natural language. You can set Title, Question text, and the prompt shown in the box. This action only works if Q&A is available for the semantic model, and it does nothing for models where Q&A has been turned off. Use it sparingly. Many report authors prefer to leave it out because the results depend on how well the model's synonyms are set up.
Web URL
The Web URL action opens a link in a new tab. Enter a fixed address in Web URL, or use the fx button to read the address from a measure. Remember that the link opens outside the report, so the user leaves the filtered context they were working in.
Apply all slicers and Clear all slicers
These two actions work with slicer behavior at the report level.
Clear all slicers removes every selection from every slicer on the current report page set. It is the quickest reset button. It does not restore a hidden panel, a changed view, or a sort order, and it does not touch filters in the Filters pane. It also does not clear a selection made by clicking directly on a chart (cross-highlighting) unless that selection is also a slicer.
Apply all slicers works together with the Query reduction setting. Open File > Options and settings > Options > Query reduction and, under Slicers, choose Add an Apply button to each slicer to apply changes when you're ready. Alternatively, choose the report-level option: Add a single Apply button to the filter pane to apply changes at once. Once you use a button with this action, the users can stage several slicer selections and then apply them with one click, which avoids a query after every choice.
Set up a staged-slicer report this way:
- Turn on the query-reduction option for slicers in Options.
- Add slicers and a button.
- Set the button's Type to Apply all slicers.
- Add a second button with Clear all slicers if users need a reset.
The two actions are a pair. Apply commits what the user chose. Clear removes it.
Conditional actions with fx
For Page navigation, Bookmark, and Web URL, the destination setting has an fx button. It lets a measure supply the value. A DAX measure that returns a page name makes one button lead to different pages:
Target Page =
IF (
SELECTEDVALUE ( 'View'[Level] ) = "Detail",
"Detail",
"Summary"
)This measure assumes a disconnected View table with a Level column, and report pages named Detail and Summary. The returned text must match a page name exactly. A later chapter in this tutorial covers dynamic button text and destinations in full, so treat this as a preview.
Disabled actions and the none state
If you leave Action turned off, the button is only a shape. It is a quick way to make a decorative label or a card-like tile. If you turn the action on but leave the destination or bookmark empty, the button looks active but does nothing, and Desktop shows a tooltip such as "No bookmark selected". Always check the tooltip when a button seems dead.
Common errors
- The bookmark applies but the page does not change. The bookmark was saved with Current page turned off. Update it with that option on, or use a page navigation button.
- The button does nothing in Desktop. You clicked without holding Ctrl, or the action is empty.
- Clear all slicers leaves a filter in place. The remaining filter comes from the Filters pane or from a visual selection. Those need a bookmark that captures the Data state instead.
- A button works in Desktop and fails in the service. Check that the destination page or bookmark still exists after publishing, and that the user has access to the report.
- Two buttons need the same extra step. Put the step into a bookmark and point both buttons at it.
Exercise
A report has a hidden page named "Detail". You want one button on the Summary page to open it. Which action type do you pick, and why would a Bookmark action also work in some designs?
Show answer
Pick Page navigation and set the Destination to "Detail", because that action opens a chosen page directly, hidden pages included. A Bookmark action also works if the bookmark was saved while Detail was the current page and the Current page option was on, because applying it then switches to that page. Page navigation is simpler because it needs no bookmark to maintain.
Exercise
You added a Clear all slicers button to a report that has three slicers and a filter set in the Filters pane. After a click, the slicers are empty but the Filters pane still limits the data. What explains this, and what is one fix?
Show answer
Clear all slicers affects slicers only, not filters in the Filters pane. One fix is to create a bookmark with the Data option on, saved when the report is in its unfiltered state, and assign it to the button with the Bookmark action. Another fix is to remove the Filters pane filter and move the choice into a slicer.