Earlier in the week i presented a webinar on: “What is new and exciting in Power BI” and presented how to add parameters to a set of reports. In the Q&A i saw a couple of people asking about how to update their report titles based on parameters. For instance in the Dashboard in an hour reports, it make good sense to update the title to highlight the fact the viewer is only seeing one specific quarter.
Turns out the solution isn’t specific to parameters and Chris Webb even did a blog post on how to do this before parameters were even released!
Chris Webb’s blog post on Dynamic Titles in Power BI: Dynamic Chart Titles In Power BI
Turns out i didn’t notice his blog post until i had my own solution; and like most my solutions while it works it is much less sophisticated versus the MVPs’!
Since the demo was in context of Parameters –lets start there even though it is not required.
Step 1. Create new parameter.
To create a new parameter click on Edit Queries then select Manager Parameters and New Parameter.
In my case i wanted to constrain it to just the four quarters so i set it to be a list of values. (see screen shot below)
Step 2. Set your file to use the new parameter.
You can use parameters throughout Power BI in this case i am using it as a filter for a table. The specific actions are:
Open the table you want to set the filter, select the column you want to filter, choose Text Filters, choose equals and note this dialog now has a drop down for the source with Text, Existing parameter and new Parameter listed.
At this point you can choose close and apply.
(note New Parameter only shows up if you have a parameter already defined!)
Step 3. Create the Measure to act as our title
To update the title dynamically we are going to cheat in two ways: we are going to build a measure to act our title and we are going to use a card to act as our title.
In my example i decided to add this measure to the date table and the way i created the measure is using the function “Firstnonblank()” –I warned you it wasn’t sophisticated!
If you haven’t create measures before this is done by going to the table right clicking and selecting “New Measure”
The specific formula for my table is:
Measure = FIRSTNONBLANK('Date'[Year],true) & " " & FIRSTNONBLANK('Date'[Quarter],true) & " Performance Data"
Step 4. Create your “Title” to display
To display that measure drag over a “Card” visual and select the measure we created above for the only field to be displayed.
At this point not only does the title display the parameter you have selected but will also display the year selected in the slicer.
Note: You will probably want to turn off the category label to get rid of the word “Measure” on your title.