Dynamic title from the selected years
Build a chart title that changes with the slicer, such as "Sales for 2023, 2024".
Sales Title =
VAR SelectedYears =
IF(
ISFILTERED('Date'[Year]),
CONCATENATEX(
VALUES('Date'[Year]),
'Date'[Year],
", ",
'Date'[Year],
ASC
),
"all years"
)
RETURN
"Sales for " & SelectedYearsHow it works
ISFILTERED tells whether the Year column is filtered at all. When it is, CONCATENATEX joins the selected years in ascending order with a comma; otherwise the text "all years" is used.
Use the measure in a visual's title: Format > Title > Text > fx, then choose the measure.
What your model needs
- A Year column in the 'Date' table.
Small example
Input data
Slicer: Year = 2023 and 2024Expected result
Sales for 2023, 2024
(no year selected: Sales for all years)Common mistakes and limitations
- Selecting every year in a slicer still counts as filtered, so the title lists them all. Test with your slicer settings. - Long lists make long titles; use MIN and MAX if you prefer "2019-2024".