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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anton0315
Frequent Visitor

Calculate running total and reset it

Hello guys,

 I have made a running total that sums up every month, but I also want it to be able to restart the running total from the next month if it reaches a certain value (100), but it doesn't work for me. For example, in January I have 50 and in February I have 50 and it collects them for me, but it's cool that I have 100 from March to start over, that is March, I have again 50 April to collect March.

3 REPLIES 3
v-kongfanf-msft
Community Support
Community Support

Hi @Anton0315 ,

 

Modify formula like below:

CumulativeSumWithReset =
VAR CumulativeSUM =
    CALCULATE (
        SUM ( data[Private KM] ),
        'Calendar 6'[Date] <= MAX ( 'Calendar 6'[Date] )
    )
RETURN
    IF ( CumulativeSUM >= 3000, 0, CumulativeSUM )

 

Best Regards,
Adamk Kong

 

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

danextian
Super User
Super User

Hi @Anton0315

Consider integrating OFFSET into one of your measures. I have attached a sample pbix file to assist you in getting started. In this example, the cumulative count resets whenever there is a blank.

danextian_0-1705532962214.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello,
It is not what I want because i don't have null values. 
Look at this pbix file:

Anton0315_0-1705561685776.png

I want after it reaches 3000 (the red line to reset the cumalative sum), as you see it should be reseting in August but it is just summing the rest of the amounts it is not cumalative sum. 

This is the meassure which I'm using 

  Var CumaltiveSUM = CALCULATE(sum(data[Private KM]), 'Calendar 6'[Date] <= max('Calendar 6'[Date]))
             RETURN
              IF(Cumaltivesum>=3000, CALCULATE(SUM(data[Private KM])), CumaltiveSUM),

I think there is a problem in the IF statment i have tried to do it alone but I can't.

Thank you in advance 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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