There are different types of titles in a Power BI Report. To help the end-users understand the report, you can make titles dynamically display which values are shown.
In this article
- Add a button
- Resize and move the button
- Create a new measure
- Add the measure to the button
- Create a tooltip title
- Make sure the measure works for all combinations
- Test the tooltip
In a Power BI report, you can have titles in the page header, in a visual, on a tooltip or drill-through page, and in other places. Because Power BI is a self-service BI tool that lets the user interact with the report, it's important that the titles are dynamically showing what has been selected by the user. Otherwise, the user might not know what data is currently shown. Since there are so many different ways to deal with dynamic titles, we will only cover a couple of often-appearing scenarios and, hopefully, you will be able to build on them.
To demonstrate some of the possibilities, we are using our very popular Zebra BI Sales dashboard demo report.
Watch how to create and design report page tooltips in Power BI.
Before we start...
As always, it's important to keep your data model and report nice and tidy. Because you will need to create new measures for dynamic titles and text, it's a good idea to organize them in a separate table. So let's create a Text Measures table first
Select Enter data > add a Name for the table and confirm with Load.
1. Dynamic Buttons
On the landing page, the drill-through button dynamically displays what is selected in the visual.
We'll only focus on the dynamic button text and not on the other styling elements and functionalities of the button. If you want to learn more about what you can do with buttons, look at this article.
First, let's add a blank button by selecting Buttons > Blank.
Now adjust the size of the button and move it to the desired position.
Because we will use conditional formatting of the Button Text, we first need to create a measure that displays exactly the text that should be shown on the button. So let's create a new measure in the Text Measures table. Right-click the Text Measures table and select New measure.
There are different DAX functions that can be used for this. In our sample, we use a different function than the one in the original button next to it. Feel free to also look at the other option directly in the report
DAX formula we use:
Button Text = IF(SELECTEDVALUE(BusinessUnits[Group])="", "", "Drill "&SELECTEDVALUE(BusinessUnits[Group])&" by Country")
The part of the formula below -
only shows a value if a value from the column Group of the table BusinessUnits has been selected. If no selection has been made, this function returns nothing.
By nesting this into an IF statement, you can define that if no Group has been selected, then show nothing (""), otherwise show what has been selected. Because we want to add some additional text to the button and not only show the Group, we can add text in quotation marks and use the & symbol in between different elements.
Now that the measure has been created, it needs to be added to the Button. To do this, select the button, then turn on the ButtonText and click the conditional formatting symbol.
Now you need to select the new measure. Because you have created a Text measures table before, it will be easy to find it.
The new button now dynamically shows the Group which has been selected in the visual or is blank if nothing has been selected.
2. Tooltip titles
As you can see below, the header of the tooltip always names the Group which is currently shown.
First of all, let's create a measure that we can use for the title. As always, there are different functions that have the same result. One such formula is the one below:
Tooltip header = SELECTEDVALUE(BusinessUnits[Group])
We use the SELECTVALUE function again because it shows exactly the value which we have selected.
Tooltip header new = IF(HASONEFILTER(BusinessUnits[BusinessUnit]), SELECTEDVALUE(BusinessUnits[BusinessUnit],""), IF(HASONEFILTER(BusinessUnits[Group]), SELECTEDVALUE(BusinessUnits[Group],""), IF(HASONEFILTER(BusinessUnits[Division]), SELECTEDVALUE(BusinessUnits[Division],""))))