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
melvin9900
Frequent Visitor

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

melvin9900_0-1657120591047.png

 

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.

melvin9900_0-1657122357932.png

 

 

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 1
tamerj1
Super User
Super User

@melvin9900 

You may try wrapping Details_table'[Metrics] with SELECTEDVALUE 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.