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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
egarstad
Frequent Visitor

DAX measure to return minimum absolute value while maintaining sign

Hi All,

I have hit a roadblock with a measure I am trying to create.

I have the following table:

Order

Work CenterActual Run TimeExpected Run Time
1

A

3020
2A2020
3B1520
4B1020

 

I am calculating the time deviation as [Actual Run Time] - [Expected Run Time].

I am trying to create a measure that calculates the smallest absolute time deviation while maintaining the sign.

So for Work Center A the two time deviations are 10 and 0. I want the measure to return 0.

For Work Center B the two deviations are -5 and -10. I want the measure to return -5.

The measure will be displayed in a table visual like this:

Work CenterMin Run Time Deviation
A0
B-5

 

I have created the following measure that calculates the minimum absolute value but I can't figure out how to keep the sign if the time deviation is negative.

 

Min Run Time Deviation =
MINX ( Table1, ABS ( Table1[Actual Run Time] - Table1[Expected Run Time] ) )
 
Any advice would be greatly apprecited.
 
Thanks!
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Well, here is one way, but I don't like it because if you have a 5 and a -5 together you will end up with the -5. Not sure if that is OK.

 

PBIX attached.

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Well, here is one way, but I don't like it because if you have a 5 and a -5 together you will end up with the -5. Not sure if that is OK.

 

PBIX attached.

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

The solution you provided works for my use case. The chances of having identical positive and negative deviations is almost 0 as the actual times are recorded in milliseconds. Thanks for the help!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors