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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Samarth-Borade
Frequent Visitor

Cummulative sum not working properly (it is adding for previous months also )

 Code: cum_tot = CALCULATE ([sum_trip_cost],FILTER(ALL(ff[Trip Date]),ff[Trip Date] < MAX (ff[Trip Date] )))
 
It is also adding value for previous month , even in slicer if i select a particular month it still adds last all month's values.
What i want : if i select 'September' Month in slicer , it will only add in september .
2 REPLIES 2
AilleryO
Memorable Member
Memorable Member

Hi,

 

If you want a running sum only within the month, wouldn't it be easier to use TOTALMTD() function ?

I do not know about the details of your project, but it seems to be the easiest way...

The formula you used is perfect when you need a running sum on all lines, but for monthly running sum the best is to use TOTALMTD or for quarter TOTALQTD...

 

Let us know if it suits your needs

Let us know

FreemanZ
Super User
Super User

hi @Samarth-Borade 

try like:

cum_tot = 
CALCULATE (
    [sum_trip_cost],
    FILTER(
        ALL(ff[Trip Date]),
        ff[Trip Date] < MAX (ff[Trip Date] )
            && YEAR( ff[Trip Date]) = YEAR( MAX (ff[Trip Date] ))
            && MONTH( ff[Trip Date]) = MONTH( MAX (ff[Trip Date] ))
    )
)

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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