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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
danielmorais
Frequent Visitor

Subtract rows from a total value

Hello everyone!

I need some help at this situation:

 

I need to subtract row values from a total value to adjust the column1, the desired value is in column2:

 

danielmorais_0-1664198099103.png

 

Can someone help me?

 

1 ACCEPTED SOLUTION

@danielmorais Well, if everything are columns then that would be:

Column 2 = if([column1] - [balance] <= 0, 0, [column1] - [balance])


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

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@danielmorais This would be the one for Balance, what is the logic for Column2???

  Balance = 
    VAR __Total = 10000
    VAR __Month = MAX('Table'[Month])
    VAR __Table = FILTER(ALL('Table',[Month] <= __Month)
RETURN
  __Total - SUMX(__Table,[Column1])


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

@Greg_Deckler ,

 

The logic is: if(column1 - balance <= 0, 0, column1 - balance)

@danielmorais Well, if everything are columns then that would be:

Column 2 = if([column1] - [balance] <= 0, 0, [column1] - [balance])


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

@Greg_Deckler thank you so much!

 

The problem was solved!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.