Forum Discussion
String Column not showing up in a switch Statement
Helllo , I am new to Power BI world.
Report Source : Tabular Model
Sample Table : Details_table
4 Measures are created in the same table to do some calculation based on business conditions using the [Value] column for each Metrics.
Measure_Revenue - Return the calculated value in $ .
Measure_Debt - Return the calculated value in $
Measure_Margin - Return the calculated value in %
Measure_Sales - Return the calculated value in whole number.
I have to create a report which shows the details like below.
I tried to create a matrix with row as a Employee and Column as Metrics. But for values I have calculated Measure values for each Metrics so I cannot use all 4 measures under the Values. I thought of creating a new measure using switch Statement to assign the calcaulated measure value to it based on the Metrics . So I can use the new measure (Final_calculated_Measure) for values in the Matrix . Something like below.
Final_calculated_Measure = Switch( Details_table'[Metrics],"Revenue",Measure_Revenue ,
,"Debt",Measure_Debt ,
,"Margin",Measure_Margin ,
,"Revenue",Measure_Revenue , 0)
This expression throwing error on Details_table'[Metrics]. I am not able to pick that column in the expression and getting a error cannont find the name. The pick list inside the switch statement shows only integer columns from the table.
Can someone please guide me how to implement this.
1 Reply
- tamerj1
Community Champion
You may try wrapping Details_table'[Metrics] with SELECTEDVALUE