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 Total Reset based on Column Attribute

Hello everyone

 

I have read numearous articles/posts regarding running total or cumulative total, but couldn't find anything as to how to reset the running total at the beginning of each year.

 

I used Quick Measure function on Power BI to calculate the running total as follows:

 

Cumulative_Net Revenue =
CALCULATE(
 SUM('Project Details_USD'[MTD Net Revenue]),
 FILTER(
  ALLSELECTED('DateKey'[Date]),
  ISONORAFTER('DateKey'[Date], MAX('DateKey'[Date]), DESC)
 )
)

 

But cannot figure out where to add the filter so that the January running total of each year equals to to January value of that year as opposed to it just continuosly adds up previous month cumulative to current month.

 

Below on the left is the screenshot of expected graph, and on the right what I got with quick measure formula:

 

 

 

Expected.jpg

 

Any help is greatly appreciated

 

Thank you,

Petek

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

If I understand you correctly, the formula below should work in your scenario. Smiley Happy

Cumulative_Net Revenue =
VAR currentYear =
    YEAR ( MAX ( 'DateKey'[Date] ) )
VAR currentMonth =
    MONTH ( MAX ( 'DateKey'[Date] ) )
RETURN
    CALCULATE (
        SUM ( 'Project Details_USD'[MTD Net Revenue] ),
        FILTER (
            ALL ( 'DateKey' ),
            YEAR ( 'DateKey'[Date] ) = currentYear
                && MONTH ( 'DateKey'[Date] ) <= currentMonth
        )
    )

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

If I understand you correctly, the formula below should work in your scenario. Smiley Happy

Cumulative_Net Revenue =
VAR currentYear =
    YEAR ( MAX ( 'DateKey'[Date] ) )
VAR currentMonth =
    MONTH ( MAX ( 'DateKey'[Date] ) )
RETURN
    CALCULATE (
        SUM ( 'Project Details_USD'[MTD Net Revenue] ),
        FILTER (
            ALL ( 'DateKey' ),
            YEAR ( 'DateKey'[Date] ) = currentYear
                && MONTH ( 'DateKey'[Date] ) <= currentMonth
        )
    )

 

Regards

Anonymous
Not applicable

Thank you very much ... This formula generated the "expected" chart.

Appeciate your time and response on this 🙂

Petek

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