Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
amirabedhiafi
Impactful Individual
Impactful Individual

Change the column name of a matrix depending on a filter selection

I have the following matrix (I simplified it) :

 

y7gK6.png

I want when I select the months for the 2020 year, the name of the column Year becomes Year 2020
so that column is dynamically modified depending on the year selection.

and the next column will be Year N-1 which is Year 2019.
How can I achieve that ?



Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini
1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @amirabedhiafi ,

 

Such an output is not available. I'd suggest you put Year to Row field in matrix visual instead.

 

1. Add a Year column to your table.

Year = "Year "& YEAR([Date]) 

2.Create a Calendat table for slicer.

Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])) 

3.Apply below measure to filter pane, set as "is 1":

Measure = 
var _selectYear=SELECTEDVALUE('Calendar'[Date].[Year])
return IF(YEAR(MAX('Table'[Date]))=_selectYear || YEAR(MAX('Table'[Date]))=_selectYear-1 ,1,0)

4.Drag [Cate] to Column field, [Year] to Row field:

 

Eyelyn9_0-1634884024254.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @amirabedhiafi ,

 

Such an output is not available. I'd suggest you put Year to Row field in matrix visual instead.

 

1. Add a Year column to your table.

Year = "Year "& YEAR([Date]) 

2.Create a Calendat table for slicer.

Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])) 

3.Apply below measure to filter pane, set as "is 1":

Measure = 
var _selectYear=SELECTEDVALUE('Calendar'[Date].[Year])
return IF(YEAR(MAX('Table'[Date]))=_selectYear || YEAR(MAX('Table'[Date]))=_selectYear-1 ,1,0)

4.Drag [Cate] to Column field, [Year] to Row field:

 

Eyelyn9_0-1634884024254.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Super User
Super User

@amirabedhiafi I am not aware of a way to make column headers dynamic like that unless you perhaps overlayed them with card visualizations that you used measures in.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.