Power BI Blog: Dynamic Visualisation Titles
2 January 2020
Welcome back to this week’s Power BI blog series. This week, we are going to look at how to create dynamic visualisation titles – whatever they might be...
Last week, we looked at creating visualisations that can be toggled between two or more data sets using a slicer. This week, we are going to address the problem of static visualisation titles.
As a refresher, we’ve created a table that broke down the Profit, Total Costs and Total Sales by country and month:
This visualisation has been designed to display either Profit, Total Costs or Total Sales, depending upon the slicer selection. From a user friendliness perspective, we have no indication of what the visualisation is presenting other than what is selected on the slicer. We should give the table a title. To do this, we click on the visualisation, then click on the format tab and we give the visualisation a title:
We have decided on ‘Profit’. However, when we change the slicer selection the title remains as ‘Profit’ – obviously, as it has been typed in (it is “static”).
In a previous blog, we discussed how to create dynamic card headings. Using this methodology, we can create the following measure:
Title = IF(
"Selected Option: " & FIRSTNONBLANK('Filters'[Filter Items],1),
We then place this measure on a Card visualisation on top of the Table:
The title card will now update to reflect the selection on the slicer:
However, this would mean that we need a title card on top of each visualisation. Thinking ahead, if we were to create a dashboard with multiple visualisations this could get quite confusing quite quickly.
Therefore, we click on the visualisation, then click on the Format tab, and finally, enable the title. Do you see that there are three dots next to ‘Title text’?
We then click on Conditional formatting:
This brings up the ‘Title text’ dialog, where we can format the title based upon a field:
In this case, we select the Title measure:
There we go: we have given the visualisation a dynamic title!
Lets make some changes to the Title measure:
Title = IF(
FIRSTNONBLANK('Filters'[Filter Items],1) & " in " & FIRSTNONBLANK('Calendar Table'[Year],1),
"Total Sales in " & FIRSTNONBLANK('Calendar Table'[Year],1)
Just to make the title a little more descriptive: