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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

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 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.