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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Formatting Calculated Column

@amitchandak 

 

Actually this is working for my conditon "VIEW_FORECASTREVENUE[COMMODITY] = "Electric" but for all other units it is giving me wrong result. Even if the commodity is different I'm getting values instead of 0.

 

I have to commodity i.e Electric and Gas but when I'm using the above formula for one commodity its giving output for another commodity as well which should not be the case

 

UsageCommodityUnitCurrent output: Unit(Kwh)Correct output desired
2346ElectricKwh23462346
2289ElectricmWh22890002289000
2364GasDTH23640
2364ElectricmWh23640002364000
2499GasDTH24990
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

Switch ( true()
[Unit] = "Kwh" ,[Usage],
[Unit] = "mWh" ,[Usage]*1000,
blank()
)

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

Switch ( true()
[Unit] = "Kwh" ,[Usage],
[Unit] = "mWh" ,[Usage]*1000,
blank()
)

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
Anonymous
Not applicable

Thanks !!!

 

It worked for all the conditions, just applied a filter with it and everything is working fine now.

 

Thanks for the help !!!

 

Regards

Anonymous
Not applicable

 

Getting the below error

 

Himanshu_13_0-1612541020968.png

 

@Anonymous , First Unit is not a column. You wrote unit not [Unit]

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.