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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.