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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Subtracting two measures

Hello everyone.

I have a simple question that keeps haunting me. I have 2 columns with Liablities and Receivables and I created formulas to sum it and then subtract.

 

Liablities Measure = SUMX(Table, Table[Liablities])

Receivables Measure = SUMX(Table, Table[Receivables])

 

What I want to do is subtract two columns for every month in a matrix.

I know the proper measure will be:

Result = Receivables Measure - Liablities Measure

 

But the question is: why formula:

SUMX(Table, Receivables Measure - Liablities Measure) outputs different results for certain motnhs than formula above?How does it work exactly?

 

Also the formula

CALCULATE(Receivables Measure - Liablities Measure)

outputs proper results too. How does it work exactly? How can I know if I'm using the proper formula in advanced calculations and results are proper?

1 REPLY 1
Greg_Deckler
Super User
Super User

@Anonymous - Tough to say with information provided, but in general, simpler is better. I would stick with 

Result = Receivables Measure - Liablities Measure

 

Unless there is some reason not to, like a measures total problem. 
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

I don't think your SUMX is a good idea there and your CALCULATE is useless because you are not switching context. So, it does 100% nothing.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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