Forum Discussion
Dynamic Column Headers in Power BI Matrix Based on Year Selection
Good afternoon,
I’m hoping someone can help me with this limitation in Power BI. I’m building a report that includes some Matrix visuals where I’ve placed a field parameter in the Rows and a few metrics in the Values. For simplicity, I’ll mention only three metrics: Current Year Sales, Previous Year Sales, and Sales Variation.
What I would like to achieve is dynamic column names that change based on the year selected in the slicer. For example, if the user selects 2024, the columns should be labeled as 'Sales 2024' and 'Sales 2023.' If 2023 is selected, they should show as 'Sales 2023' and 'Sales 2022.'
Is it possible to implement this dynamic naming of columns?
7 Replies
- SamWiseOwl
Super User
Hi Vcaze
I could be wrong but I don't believe so.
Instead you can insert a blank button: Insert | Buttons | Blank Button
Then set the Text equal to a measure:
Dynamic Button text = "Sales " & SelectedValue(table[year])- SamWiseOwl
Super User
- VcazeFrequent Visitor
Thank you for your answer. I know that the title can be dynamic, but I really need to dynamically change the column names.
Thank you.
- Kedar_Pande
Super User
Dynamic Current Year Sales Name =
"Sales " & SELECTEDVALUE(Year[Year])Dynamic Previous Year Sales Name =
"Sales " & (SELECTEDVALUE(Year[Year]) - 1)Use a Card visual to show dynamic names created in the measures above and place it on the column header.
Direct column headers in the Matrix can't change dynamically, but using additional visuals can help simulate this effect.
If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn- VcazeFrequent Visitor
Thank you for your help. That solution works for Matrix with few columns, which is not my case.
Thank you for your time
- audreygerred
Super User
Hi! It is not possible for the headers to be dynamic like you are requesting. What I usually do when someone insists on having the actual date instead of undertstanding that This Year = whatever year you are filtered to and Last Year = the year before you are filtered to I add a legend to the page using a table or cards so that they have a visual reference as to what this year and last year are representing.
- AnonymousNot applicable
Hi Vcaze ,
Currently for matrix visual, there is no support for dynamically changing column names, you can only refer to the alternative provided by SamWiseOwl audreygerred Kedar_Pande .
Best Regards,
Adamk Kong