Forum Discussion
rjobaan
3 years agoFrequent Visitor
Dynamically create column based on measure name
I have two tables: One table with all measure names in it: TABLE NAME: MEASURES Column OBJECT Column Table other table with the measur calculation in it TABLE NAME: ACTUAL Measure Actual - ...
Anonymous
3 years agoNot applicable
Hi rjobaan ,
According to your statement, I know your requirement is that you want to auto-match the measure name in "Measure" table with the actual measures by code in format ([Actual measure], table name , [MeasureName]).
As far as I know, there is not any function in Power BI that support us to do this. I think SWITCH() function should be the best way. I think you can update your code as below.
KPI =
SWITCH (
'MEASURES'[OBJECT],
"Actual - Gross", [Actual - Gross],
"Actual - Nett", [Actual - Nett],
"Measure3", [Measure3],
...,
0
)
Add all measures names and all measure into this code.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rjobaan
3 years agoFrequent Visitor
This is already what I have, but i have to many measures..And if measure are deleted or added I need to add again.