Forum Discussion
Problems on implementing RunningSum measure using DAX
Hi mfattibello,
I'm assuming you have another column on your table that identifies the ranking and not only based on the value.
Try this measure and see if it works:
CUMULATIVE =
VAR Sum_Revenue =
SUM ( Ranking[Revenue] )
RETURN
IF (
NOT ( ISBLANK ( Sum_Revenue ) ),
CALCULATE ( Sum_Revenue ),
FILTER ( ALL ( Ranking[TYPE] ), SUM ( Ranking[Revenue] ) <= Sum_Revenue )
)As you can see in my formula I assumed you have a TYPE column in wich you make the ranking work.
In this table the Ranking is made using the revenue column
Ranking = RANKX(ALL(Ranking[Revenue]),CALCULATE(SUM(Ranking[Revenue])))
However to make the cumulative total I have to use another column (TYPE).
Regards,
MFelix
Hello, MFelix and v-yulgu-msft!
Thanks for yours explanations. On my scenario, I don´t have a specific column at my table to ranking be identified. The user chooses some options at the slicer. So, according with these selections, my ranking measure is calculated based on the revenue values.
Somehow, my ranking measure is a little "crazy". As you can see at the image, the position '2' dissapeared. The measure with red borders is my revenue (divided per 1000), and the Running Sum calculation is doing correctly until the RK '5', where the calculation gets wrong.
BTW, I had to transcript the results into a Excel grid, because I cannot paste the image here :(
| RK | Running Sum | Revenue |
| 1 | 316,79 | 316,8 |
| 3 | 457,83 | 141 |
| 4 | 497,9 | 40,1 |
| 5 | 212,77 | 31,7 |
| 6 | 559,56 | 30 |
| 7 | 251,79 | 9 |
| 8 | 258,58 | 6,8 |
Best regards,
Marcos Fattibello