Forum Discussion
Cumulative Sum without repeat value
- 11 months ago
Hi Anonymous ,
In addition to what FBergamaschi said, you could try using a visual calculation with RUNNINGSUM. Here is additional information:
https://www.youtube.com/watch?v=pqfBH0ZmYkA
Your scatter plot shows duplicate dots because your DAX measure is summing all [Volume] again at the end due to how MAX(price) behaves in that context.
Fix it with this cleaner logic:
CumulativeVolume =
VAR CurrentPrice = SELECTEDVALUE('Sheet'[price])
RETURN
SUMX (
FILTER (
ALLSELECTED('Sheet'),
'Sheet'[price] <= CurrentPrice
),
[Volume]
)
This ensures each dot reflects cumulative volume up to its own priceāno repeats at the end.
- Anonymous11 months agoNot applicable
Hello Shahid12523, your answer is correct, it does an ascending order. But I would like a descending order when I modify your DAX code I back to the same issue...any tips ?
- Shahid1252311 months agoCommunity Champion
CumulativeVolumeDescending =
VAR CurrentPrice = SELECTEDVALUE('Sheet'[price])
RETURN
SUMX (
FILTER (
ALLSELECTED('Sheet'),
'Sheet'[price] >= CurrentPrice
),
[Volume]
)
use this
Instead of <= CurrentPrice, we use >= CurrentPrice to accumulate volumes from higher prices down to the current one.- Anonymous11 months agoNot applicable
Yes, I alrealdy did it. But it shows that..like the original issue...