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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.