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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
aktripathi2506
Helper IV
Helper IV

DAX for Cumulative subtraction

I have two columns 

 

ValueTotal
10600
20600
40600
30600
10600
80600
20600
40

600

 

Expected output is

 

Output
590
570
530
500
490
410
390
350

 

Please suggest a DAX formula to perform this action.

Thanks in advance.

1 ACCEPTED SOLUTION
CheenuSing
Community Champion
Community Champion

Hi @aktripathi2506

 

1. From your table display choose Edit Query

2. When the Query Editor Opens up choose AddColumn tab and Index Column from 0

3. Create RunTot columns as

    RunTot = CALCULATE(sum(Table1[Value]), FIlter(Table1,Table1[Index]<=EARLIER(Table1[Index])))

    ( replace Table1 by the name of your table )

4. Create another column Final 

    Final = [Total]-[RunTot]

5. Plot the values in a Table Chart and you will get the desired output.

  

Capture.GIF 

 

If this works for you please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
CheenuSing
Community Champion
Community Champion

Hi @aktripathi2506

 

1. From your table display choose Edit Query

2. When the Query Editor Opens up choose AddColumn tab and Index Column from 0

3. Create RunTot columns as

    RunTot = CALCULATE(sum(Table1[Value]), FIlter(Table1,Table1[Index]<=EARLIER(Table1[Index])))

    ( replace Table1 by the name of your table )

4. Create another column Final 

    Final = [Total]-[RunTot]

5. Plot the values in a Table Chart and you will get the desired output.

  

Capture.GIF 

 

If this works for you please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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