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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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