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
Anonymous
Not applicable

Running totals in dates with year filter

Hi,

I'm trying to calculate at Running Total over dates and then group by month, quarter and year.

 

I have this measure showing a running total of sales.

It works just fine on regulary dates, but if I group by year or sort out a year it doesn't work anymore:

 

Total Sales Amount RT =
VAR MaxDate = MAX ('Calendar'[Date])
VAR Result =
CALCULATE(
[Total Sales Amount],
'Calendar'[Date]<MaxDate
)
RETURN
Result
 
Here I have filtered out 2022, and I would expect RT to follow and start from 0 but it doesn't. 
 
Krestensb_0-1657890570701.png

What's wrong with my measure?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this

Total Sales Amount RT =
VAR MaxDate =
    MAX ( 'Calendar'[Date] )
VAR Result =
    CALCULATE (
        [Total Sales Amount],
        FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] < MaxDate )
    )
RETURN
    Result

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this

Total Sales Amount RT =
VAR MaxDate =
    MAX ( 'Calendar'[Date] )
VAR Result =
    CALCULATE (
        [Total Sales Amount],
        FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] < MaxDate )
    )
RETURN
    Result

 

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

Thanks, but this only works if you are after YTD.

It will start over 1. jan.

I need it to be a running total regardless of the year.

Anonymous
Not applicable
Anonymous
Not applicable

Hi Krestensb,

 

If you want it by year use totalytd, it will do it automatically

 

Helpful resources

Announcements
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!

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.

Top Solution Authors