Power BI Blog: Dynamic Headings for In-Between Variables
18 February 2021
Welcome back to this week’s edition of the Power BI blog series. This week, we’ll discuss another approach to dynamic headings, this time for variables between two periods using a time slicer selection.
Last week, we talked about Dynamic Headings Based on Time Slicer for a stock variable from a Year slicer, in order to calculate current liabilities and current assets.
This week, we will build on last week’s blog and take it to the next level by creating a dynamic chart title with a start date and an end date. In the example below, I have already created a Year slicer that has been extracted from a Calendar table, as well as a Profitability Selection slicer, leaving space at the top of the chart for a heading.
Now, to create a dynamic heading that shows the start and end date selected in the Year slicer, I need to create a measure.
Profit selection title = "Profit for " & MIN('Calendar'[Year]) & " to " & MAX('Calendar'[Year])
I am using the MIN and MAX functions to define the values selected in the Year slicer. To get the heading on the dashboard, select the card and drag the measure created above to the Fields section, viz.
The heading card will now look like this:
To get the card with only the heading, navigate to the Format panel and turn off Category.
Resize and realign the card to bring it on top of the visual. Now, select from 2021 to 2025 to ensure the dynamic heading works fine.