Forum Discussion
Cumulative sum on a ranked table
- 2 years ago
output
measures :
ranking measure :rnk = RANKX( ALLSELECTED(tbl1[Product]),CALCULATE(sum(tbl1[monthly sales])),,DESC)measure cumul :
cumulative sum = var current_ranking = [rnk] var s = CALCULATE( SUM(tbl1[monthly sales]), FILTER( ALLSELECTED(tbl1[Product]), [rnk] <=current_ranking ) ) return scumult%
cumult % = [cumulative sum] / CALCULATE(SUM(tbl1[monthly sales]), ALLSELECTED(tbl1[Product]) )if my ansswer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
How to provide sample data in the Power BI Forum
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
How to Get Your Question Answered Quickly
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
This is a list of all the product for a certain customer. The sales column is already sorted from high to low. I want the cumlutavie% column to be the running sum of Sale%. right not it is calculating the running sum but in a different order. In the end I want to be able to filter products by the top % (i.e. top50% or top 80%)