Forum Discussion
Cumulative Sum without repeat value
Hello PowerBi communauty,
I did a measure DAX to cumulative sum, but when I created a plot scatter it looks like I have all "price" again at the end of the visual. I have double plots..Can you help me? How can I show my dot (price) based on cumulative Axis-X without repeat value at the end ?
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
8 Replies
- FBergamaschiSuper User
Please turn the visual into a table and look at the values calculated through your measure, are they ok or not?
We shall go back to this visual once we are sure numbers are correct
Best
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- AnonymousNot applicable
Hello FBergamaschi, yes they are correct
- FBergamaschiSuper User
Ok so the calculation is correct
I am not sure the scatter plot is the right chart but on that I cannot help on why you get those weird stuff, is this the only graph you can use?
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- djurecicSuper User
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
- Shahid12523Community Champion
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.- AnonymousNot 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 ?
- Shahid12523Community 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.- AnonymousNot applicable
Yes, I alrealdy did it. But it shows that..like the original issue...