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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AliceW
Impactful Individual
Impactful Individual

Cumulative Total per Account

Hello everyone,

I know, yet another post on Cumulative Total, but for the life of me I can't figure out how to make it work using the existing posts.

Sooo, I have two tables:

  • Accounts (one line per Account)
  • Opps (1 Account can have 0, 1, or more Opps)

I have this measure:

Amount = calculate(sum('Opps'[Amount]))
 
I then created
% of total =
divide(
[Amount],
calculate(
[Amount],
ALLSELECTED('Accounts')
)
)
 
What I can't get is the Cumulative Amount... Like this:
 
AccountAmount% of TotalCumulative Amount
Apples100045%1000
Pears70032%1700
Oranges50023%2200
TOTAL2200100% 
 

Can anyone help, please?

Thank you,

Alice

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @AliceW ,

 

You can use the CUMULATIVE_SUM function to calculate the cumulative sum of a measure. Here is an example of how you can use it:

Cumulative Amount =
CALCULATE (
    SUM ( 'Opps'[Amount] ),
    FILTER (
        ALL ( 'Accounts' ),
        'Accounts'[Account] <= MAX ( 'Accounts'[Account] )
    )
)


This measure will calculate the cumulative sum of the Amount column from the Opps table for each row in the Accounts table, based on the Account column.

You can then use this measure in a pivot table or matrix visualization to display the cumulative amount for each account, like this:

vhenrykmstf_0-1671181977751.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

2 REPLIES 2
AliceW
Impactful Individual
Impactful Individual

Thank you, Henryk!!

v-henryk-mstf
Community Support
Community Support

Hi @AliceW ,

 

You can use the CUMULATIVE_SUM function to calculate the cumulative sum of a measure. Here is an example of how you can use it:

Cumulative Amount =
CALCULATE (
    SUM ( 'Opps'[Amount] ),
    FILTER (
        ALL ( 'Accounts' ),
        'Accounts'[Account] <= MAX ( 'Accounts'[Account] )
    )
)


This measure will calculate the cumulative sum of the Amount column from the Opps table for each row in the Accounts table, based on the Account column.

You can then use this measure in a pivot table or matrix visualization to display the cumulative amount for each account, like this:

vhenrykmstf_0-1671181977751.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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