Forum Discussion

sjelting's avatar
sjelting
Frequent Visitor
3 years ago
Solved

Cumulative Sum over grouped by Column

Hello,   i have a dataset looking like:   date,category,amount 0,2,1 1,2,3 1,2,4 4,5,6   the amount should be summed up by category in a certain interval, so that it looks like this if date...
  • tamerj1's avatar
    3 years ago

    Hi sjelting 
    Please refer to attached sample file with the solution

    Measure = 
    VAR CurrentAmount = SUM ( q[amount] )
    RETURN
        SUMX (
            FILTER (
                ALLSELECTED ( q[category] ),
                CALCULATE ( SUM ( q[amount] ) ) <= CurrentAmount
            ),
            CALCULATE ( SUM ( q[amount] ) )
        )