Reply
jacqueshervo
Regular Visitor

Cumulative Sum by User not working properly

Hi there! 

I want to look at the cumulative amount of savings ([savings]) by user ([external_payment_id]) over time ([event_month]).

It's working for 1 or 2 specific users when I filter the plot on the user's id.

However, the cumulative sum doesn't make sense at all when I select all users. 

 

I don't understand why it's working for a couple of random users, and not all. 

Do you guys have an idea?

 

Here is the code below as well as the plots shows on PowerBI

 

CumulativeSavings =
CALCULATE(
SUM('monthly_user_metrics'[savings]),
FILTER(
ALLEXCEPT('monthly_user_metrics', 'monthly_user_metrics'[external_payment_id]),
'monthly_user_metrics'[event_month] <= MAX('monthly_user_metrics'[event_month])
)
)

 

Screenshot 2024-08-14 at 16.27.21.pngScreenshot 2024-08-14 at 16.27.32.png

 

Thank you so much for your help!


2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@jacqueshervo Try Better Running Total. Better Running Total - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Hi @v-yajiewan-msft, thank you so much for taking the time to test the issue on your own! I believe that there are some issues when I take into acconts a lot of users or some weird users I have in my database.

it's good to know that I got the right way though! 

 

thank you so much! 

View solution in original post

5 REPLIES 5
v-yajiewan-msft
Community Support
Community Support

Hi @jacqueshervo , Greg_Deckler, thank you for your prompt reply!

 

I did a sample test based on your description, but was unable to reproduce your issue.

vyajiewanmsft_0-1723786226781.png

vyajiewanmsft_1-1723786241268.pngPlease check my test pbix to see if I missed anything, and if possible you can also upload your example file for better testing.


Thank you for your understanding!

 

Best regards,

Joyce

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

Hi @v-yajiewan-msft, thank you so much for taking the time to test the issue on your own! I believe that there are some issues when I take into acconts a lot of users or some weird users I have in my database.

it's good to know that I got the right way though! 

 

thank you so much! 

Greg_Deckler
Super User
Super User

@jacqueshervo Try Better Running Total. Better Running Total - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

hey @Greg_Deckler, I tried the running total, but it looks like it doesn't cumulate sum properly. 

here is the code I used to get the following chart:

 

RunningTotalSavings2bis =
CALCULATE(
DIVIDE(SUM(monthly_user_metrics[savings]), DISTINCTCOUNT(monthly_user_metrics[external_payment_id]),0),
FILTER(
ALL('monthly_user_metrics'[mss]),
'monthly_user_metrics'[mss] <= MAX('monthly_user_metrics'[mss])
)
)

Screenshot 2024-08-16 at 12.38.51.png


do you have an idea why?

thank you so much!

Jacques

hi @Greg_Deckler, thank you for replying!

I've tried your solution and it looks like it's working properly.

thank you so much! 

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)