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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
robbielambert
Frequent Visitor

Calculation ordering question

Hi, thanks in advance for the help on this.

 

I have two measures which are quite complex. that yield results at a row level that look something like this:

 

Account IdMeasure AMeasure B
A132
A259
A376
A423

 

I need to calculate a new meaure which is sum(Measure A - Measure B).

 

But for each row, if Measure A - Measure B is less than zero, I want to set the result to zero, so the desired result would be:

 

A1: 3 - 2 = 1

A2: 5 - 9 = 0

A3: 7 - 6 = 1

A4: 2 - 3 = 0

Total = 2

 

How do I instruct power bi to calculate the measures at a row level applying the zero rule first, then aggregate, rather than aggregating then applying the zero rule.


Thanks

 

Robbie

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @robbielambert ,

 

 

1.jpg

Suppose your measures are Measure AA and Measure BB

 

Diff of Measure = SUMX('Table',[Measure AA] - [Measure BB])

 

Final Measure = 

SUMX('Table', IF ([Diff of Measure] < 0 ,0, [Diff of Measure]))

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

 

 

 

View solution in original post

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @robbielambert ,

 

 

1.jpg

Suppose your measures are Measure AA and Measure BB

 

Diff of Measure = SUMX('Table',[Measure AA] - [Measure BB])

 

Final Measure = 

SUMX('Table', IF ([Diff of Measure] < 0 ,0, [Diff of Measure]))

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

 

 

 

Hi Harsh,

 

Works like a treat!

 

You are a scholar and a gent thank you!

 

Robbie

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.