Power BI: Dynamic Title based on Slicer selection
Background
Many times the report consumers want the chart title to get updated with the slicer selection. In this blog post, I’ll show you how to set dynamic titles for visuals using DAX.
The Data
Here I have the column chart displaying Sales by Date. I have a ‘Country’ slicer as well. My intention here is to change the title of the chart to display the name of the country selected in the slicer. Right now, the title of the chart is static — ‘Sales by Date’.
*For simplicity’s sake, I am taking one slicer as an example.
A. Steps to create a dynamic title (Single Selection)
Step A.1 : Create a new calculated measure with the below DAX:
Title Single Select = “Sales for country -” & SELECTEDVALUE(financials[Country],”All Countries”)
This is a simple expression that will return the name of the country if only one country exists in the filter context, if not, it will return the text “All Countries”.