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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculate running total based on sales

Hi, I would like to calculate the running total based on the product sales.

Below is my sample dataset:

gwjjjjj_0-1717111257503.png

I want to calculate the running total in this order: group by product, and get total sales for each product. And calculate running total sales based on that.

gwjjjjj_1-1717111316912.png

I tried to use running total measure in power bi, but it doesn't work.

Does anyone happend to know the solution for this question? Thanks ahead.

1 ACCEPTED SOLUTION

@Anonymous 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

You can try formula like below:

MEASURE =
VAR SUM_BY_Pro =
    CALCULATE ( SUM ( 'Table'[Sales] ), ALLEXCEPT ( 'Table', 'Table'[Product] ) )
RETURN
    DIVIDE ( SUM_BY_Pro, CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) ) )

vkongfanfmsft_0-1717118565936.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@Anonymous 

you can try this

 

Measure = sum('Table'[Sales])
PROPORTION = [Measure]/CALCULATE(SUM('Table'[Sales]),ALL('Table'))
P2 =
var _PROPORTION=[PROPORTION]
RETURN CALCULATE([PROPORTION],FILTER(ALL('Table'[Product]),[PROPORTION]>=_PROPORTION))
 
11.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

That's works! One more question if you don't mind. If I have one more column called month. I want to add a month slicer, so user can check running total for different month. I try to use your method to do it, but it doesn't work.  Thank you so much for your help.

gwjjjjj_0-1717134067865.png

 

@Anonymous 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors