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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Ericwhv
Helper II
Helper II

If Statement in Measurement

Hi All

Thank you for your help in advance.

i am trying to do a truck utilization for each lane

 

we have the fake details as below:

Truck_LaneChargeable 1:6
FRAMLH6814
FRACDG893
MLHCDG8731
BRUAMS913
LHRSNN8659
LHRBHX9028
LHRSNN828
BRUAMS7553
ISTFRA7719
FRABUD809

 

at the begining, i use below two mearsurement to calcuate the "Truck Utilization"

Avg Chrg Weight Per Truck = AVERAGE(Truck_Level[Chargeable 1:6])
Truck Utilization(AVG) = DIVIDE([Avg Chrg Weight Per Truck], 10666)
10666 is = 100% utilization
 
Now, we have some issue, we are using the same 1 truck to serve two lane
FRAMLH and MLHCDG, so, we cannot use these average weight per truck to divided by "10666" but "10666 / 2 = 5333"
 
Now, i want to write a meansurement that if.... the lane is FRAMLH or MLHCDG, we will need to divided by 5333 instead of 10666
 
how can i write a measurement add this if statement?
 
if(lane = FRAMLH or MLHCDG -> average weight per truck divided by 5333, rest divided by 10666

Thank you so much!
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ericwhv , Try like

 

Truck Utilization(AVG) = DIVIDE([Avg Chrg Weight Per Truck], if(Max(Table[Truck_Lane])  in {"FRAMLH","MLHCDG"} , 5333, 10666))

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

1 REPLY 1
amitchandak
Super User
Super User

@Ericwhv , Try like

 

Truck Utilization(AVG) = DIVIDE([Avg Chrg Weight Per Truck], if(Max(Table[Truck_Lane])  in {"FRAMLH","MLHCDG"} , 5333, 10666))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.