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
M_SBS_6
Helper V
Helper V

Running Total

Hi, 

I have a running total line chart which seems to be working if my x-axis is uses the Year and Month hierarchy. I see a continued growth.

 

My legend is a Column which has grouped a Product. 

 

However, if I change the x-axis to show just the month (as I want the total for all years Jan to Dec), I lose the cumulative view, it then just gives me the total for each month. 

 

Any idea how I can change this please? 

 

My measure:

 

Run_total=

Calculate(sum(prod[amt],

Filter( Allselected (prod),

Prod[date] <= max prod[date])))

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @M_SBS_6 ,

@some_bih Thanks for your concern about this case!
Here is my sample data:

vjunyantmsft_0-1712025048754.png

And I have tested your measure, but there is nothing wrong with it. Here are the test results:

vjunyantmsft_2-1712025124031.png

vjunyantmsft_1-1712025115669.png

vjunyantmsft_3-1712025137805.png

Whether I use a hierarchy of dates or not, I can have cumulative totals appearing. 
If you are facing this situation:

vjunyantmsft_4-1712025246229.png

You can try to view it by clicking on this button:

vjunyantmsft_5-1712025269486.png

And after clicking it will change into this:

vjunyantmsft_6-1712025297470.png

If your problem is still not solved, it would be helpful if you could provide us with your sample data, thank you!

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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This approach should work.

  1. Create a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number column
  2. Create a relationship (Many to One and Single) from the Date column of the Prod Table to the Date column of the Calendar Table
  3. To your visual/slicers/filters, drag any date related field from the Calendar Table
  4. Write these measures

Total = sum(Prod[amt])

Running total = calculate([Total],datesbetween(Calendar[date],minx(all(calendar),Calendar[date]),max(calendar[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @M_SBS_6 ,

@some_bih Thanks for your concern about this case!
Here is my sample data:

vjunyantmsft_0-1712025048754.png

And I have tested your measure, but there is nothing wrong with it. Here are the test results:

vjunyantmsft_2-1712025124031.png

vjunyantmsft_1-1712025115669.png

vjunyantmsft_3-1712025137805.png

Whether I use a hierarchy of dates or not, I can have cumulative totals appearing. 
If you are facing this situation:

vjunyantmsft_4-1712025246229.png

You can try to view it by clicking on this button:

vjunyantmsft_5-1712025269486.png

And after clicking it will change into this:

vjunyantmsft_6-1712025297470.png

If your problem is still not solved, it would be helpful if you could provide us with your sample data, thank you!

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

some_bih
Community Champion
Community Champion

Hi @M_SBS_6 based on your description and measure, it seems that in some of your measure DAX functin ALLSELECTED is used in definition (Allselected - you wrote above9.

Using ALLSELECTED, according to best practice is for visual. Still, if you define measure with ALLSELECTED  and create another measure which reference first measure with ALLSELECTED  in definition, the issue like unlogical results or hard to intepred result occur.

If above is case for your measures, when rewrite measures.





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

Proud to be a Super User!






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.