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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

how to create dynamic multiple column name in matrix?

Hi experts, I created a multiple dimension matrix, my solution is first created in dimension table and then use the switch true DAX get the revelent measure:

1.dimension table I created:

oakfc_0-1717581702393.png

2.measure I created:

cal_amount=
SWITCH(SELECTEDVALUE(dim_2Y[num]),
1,IF(ISBLANK([cal_amount_FYTD_PreviousM_FY-1]),"-",[cal_amount_FYTD_PreviousM_FY-1]),
2,[cal_amount_FYTD_PreviousM_Increase%_Y-1],
3,[cal_amount_FYTD_PreviousM],
4,[cal_amount_FYTD_PreviousM_Increase%_Y])

3.here is the result:

oakfc_1-1717581914545.png

4. as can be seen above, the column name of year_name just come from dimen table and can not be changed, so how to get the dynamic column name based on slicer? for example, when selected FY24, then the column name of year_name keeps two value FY24, FY23, or 24,23




but the problem is that when selected the year, the year name is remained the same, so how to get the dynamic column name based on the slicer?

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@Anonymous  there's no way to change the column name dynamically. You can change it to a . so that 'year_name' doesn't display on your matrix. You can also use the 'Title' of the matrix or the 'subtitle' of the matrix (in the formatting for the matrix) to display the Years selected in your slicer. 

 

To do that, click on the 'fx' in the title or subtitle formatting, then add a measure. Try a measue such as: 

[fx Matrix Title selected Years] = CONCATENATEX ( VALUES( TableName[YearColumnNameUsedInSlicer] ), TableName[YearColumnNameUsedInSlicer] , ", " )

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

1 REPLY 1
AllisonKennedy
Super User
Super User

@Anonymous  there's no way to change the column name dynamically. You can change it to a . so that 'year_name' doesn't display on your matrix. You can also use the 'Title' of the matrix or the 'subtitle' of the matrix (in the formatting for the matrix) to display the Years selected in your slicer. 

 

To do that, click on the 'fx' in the title or subtitle formatting, then add a measure. Try a measue such as: 

[fx Matrix Title selected Years] = CONCATENATEX ( VALUES( TableName[YearColumnNameUsedInSlicer] ), TableName[YearColumnNameUsedInSlicer] , ", " )

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.