Forum Discussion

aktripathi2506's avatar
9 years ago
Solved

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.

  • Anonymous's avatar
    Anonymous
    9 years ago

    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.

      

     

     

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

     

    Cheers

     

    CheenuSing

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

      

     

     

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

     

    Cheers

     

    CheenuSing