Forum Discussion

Grygger's avatar
Grygger
Frequent Visitor
5 years ago

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.

 

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