Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

cumulative sum without date

Hi! I need to identify the most sold products which represent 80% of my sales. For instance:

 

PRODUCT           SALES           CUMULATIVE SALES

A                           50                             50

B                           20                             70

C                          10                              80

D                           8                              88

E                           7                               95 

F                           5                              100

 

Therefore, products A, B and C represents 80% of my sales.

 

I am able to get cumulative sales with a date dimension, but for this exercise, date is not taken into account.

 

Regards.

1 ACCEPTED SOLUTION

@Anonymous 

Cumulative is based on the sort order , You can sort on sales

Cumm1 = CALCULATE(sum('product'[SALES]),FILTER(all('product'),'product'[SALES]>=MAX('product'[SALES])))

 

Better you create a dense rank and use that. New column

rank = ranks(all(Product),Product[sales],,asc,dense)

 

Use rank in last formula

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

12 REPLIES 12
amitchandak
Super User
Super User

@Anonymous ,

Can you try like

 

Cumm Sales = CALCULATE(SUM(Table[Sales]),filter(Table,Table[PRODUCT] <=maxx(Table,Table[PRODUCT])))
Cumm Sales = CALCULATE(SUM(Table[Sales]),filter(Table,Table[PRODUCT] <=max(Table[PRODUCT])))

 

 

You can also use the quick measure to create running total

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for your answer but none of your measures cumulate sales. All of them only show up Sales without cumulation

Try with all. Have you tried quick measure

Cumm Sales = CALCULATE(SUM(Table[Sales]),filter(all(Table),Table[PRODUCT] <=maxx(Table,Table[PRODUCT])))
Cumm Sales = CALCULATE(SUM(Table[Sales]),filter(all(Table),Table[PRODUCT] <=max(Table[PRODUCT])))

 

https://docs.microsoft.com/en-us/power-bi/desktop-quick-measures

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Sorry but none works:

 

Cumm Sales maxx = CALCULATE(SUM(SALES[SALES]);filter(SALES;SALES[PRODUCT]<=maxx(SALES;SALES[PRODUCT])))
 
Cumm Sales max = CALCULATE(SUM(SALES[SALES]);filter(SALES;SALES[PRODUCT]<=max(SALES[PRODUCT])))
 
quick measure.PNGcumulative.PNG

@Anonymous , I think the last column is working, sort on product and check . Also you can move product in separate Tale and join on the product and try

Cumm Sales max = CALCULATE(SUM(SALES[SALES]);filter(All(Product;Product[PRODUCT]<=max(Product[PRODUCT])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thanks for your answer but I need to identify the most sold products, so I need to start cumulating from the most sold to the least sold product.

 

Creating a new table for Product gives me the same result.

 

@Anonymous , Please find the attached solution

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak I really appreciate your help but your measure works because A is the most sold product and F is the least sold product.

 

If you change the product names to other which do not meet the alphabet order, the formula does not work. For instance:

 

Captura.PNG

 

May you please try with these product names?

 

Thanks in advance

@Anonymous 

Cumulative is based on the sort order , You can sort on sales

Cumm1 = CALCULATE(sum('product'[SALES]),FILTER(all('product'),'product'[SALES]>=MAX('product'[SALES])))

 

Better you create a dense rank and use that. New column

rank = ranks(all(Product),Product[sales],,asc,dense)

 

Use rank in last formula

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak This is the measure I was looking for!

 

Cumm1 = CALCULATE(sum('product'[SALES]),FILTER(all('product'),'product'[SALES]>=MAX('product'[SALES])))

 

Thanks a million! 

MattAllington
Community Champion
Community Champion

This is a standard pattern. You can read about it here https://www.daxpatterns.com/abc-classification-dynamic/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

Sorry but this example does not fit as my exercise has only one table with these two columns. I just need to set up cumulative sales

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.