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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Oomsen
Helper III
Helper III

Cumulative sum of a measure

This is my measure Cashflow forecast = CALCULATE(SUM(Beginbalans[Periode beginsaldo]) + [Liquide middelen] + SUM('Debiteuren'[Bedrag]) + SUM('Crediteuren'[Bedrag])) I would like to have the cumulative per month. 

1 ACCEPTED SOLUTION

Ah... there is your problem. What you're trying to do is calculated a running total. 
Now in your example, there is a row context. So for every row you're doint the calculation. What you should do, is create the a total till the current rowcontext. 

A running total is explained here at the DAX patterns site. 

 

Query should look like this: 

MeasureName = 
CALCULATE (
    [YourMeasure];
    FILTER (
        ALL ( datetable[date] );
       datetable[date] <= MAX ( datetable[date] )
    )
)


I've also created an example file for you which you can download here. 


Hope this works for you. 
- Marc

View solution in original post

3 REPLIES 3
marclelijveld
Resolver I
Resolver I

Why are you using Calculate in this case? You aren't applying any filter context. 

Regarding your question. Add this measure to a column chart with the months on your x-axis... This should work, in case this results in the same value for every month, check your relationships in your model and your DAX measures. Your referencing other measures like [Liquide midellen] which might impact the filter context of your measure. 

- Marc

I thougt Calculate wass neccesary. Now i see it doesn't. But the result of sum is the amount per month and not the cumulative per month. this is my result:

                Openingbalans      Cashchanges      Receivables     Payables   Cashflow

Jan           362441,14              -94613,17           0                     0                267827,97

Feb           0                            -271768,02         0                     0                -271768,02

 

What i want to see is 267827,97 - 271768.,02 = -3940,05

Ah... there is your problem. What you're trying to do is calculated a running total. 
Now in your example, there is a row context. So for every row you're doint the calculation. What you should do, is create the a total till the current rowcontext. 

A running total is explained here at the DAX patterns site. 

 

Query should look like this: 

MeasureName = 
CALCULATE (
    [YourMeasure];
    FILTER (
        ALL ( datetable[date] );
       datetable[date] <= MAX ( datetable[date] )
    )
)


I've also created an example file for you which you can download here. 


Hope this works for you. 
- Marc

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