Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Cumulative Sum without date column

I have a table like this below. Age, Type and Qty are column from file and Cumm Sum is the required column using DAX.

 

I want Cumm Sum column which will have cumulative sum. Please help me to write DAX to get Cumm Sum column from above example. Thanks in advance,

Rajesh S Hegde

  • Hi Anonymous 

    take a look at the following solution:

     

    Running Total = 
    CALCULATE(
        SUM('Table'[Qty]),
        FILTER(
            ALLEXCEPT('Table','Table'[Type]),
            MAX('Table'[Age (in M)]) >= 'Table'[Age (in M)]
        )
    )

     

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

3 Replies

  • FrankAT's avatar
    FrankAT
    Community Champion

    Hi Anonymous 

    take a look at the following solution:

     

    Running Total = 
    CALCULATE(
        SUM('Table'[Qty]),
        FILTER(
            ALLEXCEPT('Table','Table'[Type]),
            MAX('Table'[Age (in M)]) >= 'Table'[Age (in M)]
        )
    )

     

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi FrankAT ,

       

      This is working as expected. Thanks a lot for quick response.

       

      Regards,

      Rajesh S Hegde

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Anonymous 

     

    What criterium establishes the cumulative values? Is it the Qty? Is it the "Age" column? If so, from max to min or viceversa?

    In other words, what establishes the order for the cumulative values?

     

    PS: it would be very helpful if you included the data in a table of actual values (not an image) so we can simply copy and paste to work on...