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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Grygger
Frequent Visitor

Dynamic column names from measure returned from SWITCH()

Using a toggle for QoQ or YoY growth, I'm using a switch function to return either the QoQ growth or YoY growth rate and populate a matrix column with the respective growth rate.

 

I have the SWITCH() function working correctly where there's a table containing the respective QoQ or YoY options for the toggle box. The image below is for the toggle table.

Grygger_0-1631198384982.png

 

What I can't seem to figure out is based on results of the switch function, how to have the column name be dynamic based on what's returned. Currently, regardless of the values populated in the measure using the switch function, the column name is just the name of the measure,

 

The measure itself is fairly simple

QTD Sales Toggle = SWITCH(SELECTEDVALUE(ToggleButton[KPI_No]), 1, [Sales QTD LY], 2, [Sales QTD LQ])
 
Ultimately, if it returns the Sales QTD LY, I'd like the column name to adjust and say 'Sales QTD LY'. If it returns [Sales QTD LQ] then the column name would become 'Sales QTD LY'
4 REPLIES 4
LukeVanLaar26
Regular Visitor

This can be done with the new field parameters feature. Create a new field parameter and add the measures that you would like to toggle between, keep the checkbox for "add slicer to page" enabled. Upon creation of the parameter you will get a new calculated table, one of the columns will be unhidden. Place that unhidden column on your matrix. Interacting with the slicer will change the measure, along with column header.

v-jingzhang
Community Support
Community Support

Hi @Grygger 

 

Currently Power BI doesn't support dynamic column names. You can vote up for these similar ideas:

Microsoft Idea  · Dax calculated measure name / Dynamic column headers

Microsoft Idea  · Need facility to change column name dynamically.

Microsoft Idea  · Dynamic Column Names in a table

 

Best Regards,
Community Support Team _ Jing

amitchandak
Super User
Super User

@Grygger , I am assuming you want to change the measure display name. I doubt that is possible 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Well it's really just the column heading that I'd like to change, is there anyway for that to be dynamic based on which measure is returned through the switch function? Or even just showing the name of the returned measure?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors