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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
aaronzheng
Helper II
Helper II

Calculate cumulative running total per day.

Hi, I have application counts grouped by each hour. I would like to have a running total of the applications each day. In other words I want to sum the applications and have it reset for the next day.

 

aaronzheng_0-1630433601295.png

 

The runningtotal is adding up but I need it to reset on each new day.

 

This is the dax expression for the runningtotal column :

 

RunningTotal =
CALCULATE(
    SUM('FLA'[ApplicationCount]),
    FILTER(
        ALL(FLA),
FLA[ApplicationHourEST] <= EARLIER(FLA[ApplicationHourEST]
    )
))
 
Thanks in advance.
2 ACCEPTED SOLUTIONS

Hi @aaronzheng 

Maybe you can add a calculated column FLA[Date] which is equal to ApplicationHourEST but is only a date and note a datetime.
And then I think the following measure will answer your need :

RunningTotal =
CALCULATE(
    SUM('FLA'[ApplicationCount]),
    FILTER(
        ALL(FLA),
FLA[ApplicationHourEST] <= EARLIER(FLA[ApplicationHourEST]
    )
), VALUES(FLA[Date])= FLA[Date])

View solution in original post

PaulDBrown
Community Champion
Community Champion

try the following code:

 

RunningTotal =
VAR _Date =
    DATE ( YEAR ( FLA[ApplicationHourEST] ), MONTH ( FLA[ApplicationHourEST] ), DAY ( FLA[ApplicationHourEST] ) )
RETURN
    CALCULATE (
        SUM ( 'FLA'[ApplicationCount] ),
        FILTER (
            ALL ( FLA ),
            FLA[ApplicationHourEST] <= EARLIER ( FLA[ApplicationHourEST] )
                && FLA[ApplicationHourEST] = _Date
        )
    )

 

 




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

try the following code:

 

RunningTotal =
VAR _Date =
    DATE ( YEAR ( FLA[ApplicationHourEST] ), MONTH ( FLA[ApplicationHourEST] ), DAY ( FLA[ApplicationHourEST] ) )
RETURN
    CALCULATE (
        SUM ( 'FLA'[ApplicationCount] ),
        FILTER (
            ALL ( FLA ),
            FLA[ApplicationHourEST] <= EARLIER ( FLA[ApplicationHourEST] )
                && FLA[ApplicationHourEST] = _Date
        )
    )

 

 




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






AntoineTRICHET
Resolver III
Resolver III

Hi @aaronzheng 

Try the following measure :

RunningTotal =
CALCULATE(
    SUM('FLA'[ApplicationCount]),
    FILTER(
        ALL(FLA),
FLA[ApplicationHourEST] <= EARLIER(FLA[ApplicationHourEST]
    )
), VALUES(DATE(YEAR(FLA[ApplicationHourEST]),MONTH(FLA[ApplicationHourEST]),DAY(FLA[ApplicationHourEST]))=DATE(YEAR(FLA[ApplicationHourEST]),MONTH(FLA[ApplicationHourEST]),DAY(FLA[ApplicationHourEST]))

Hoping it will help you

Hi Antoine,

 

I get this error: The VALUES function expects a column reference expression or a table reference expression for argument '1'.

Hi @aaronzheng 

Maybe you can add a calculated column FLA[Date] which is equal to ApplicationHourEST but is only a date and note a datetime.
And then I think the following measure will answer your need :

RunningTotal =
CALCULATE(
    SUM('FLA'[ApplicationCount]),
    FILTER(
        ALL(FLA),
FLA[ApplicationHourEST] <= EARLIER(FLA[ApplicationHourEST]
    )
), VALUES(FLA[Date])= FLA[Date])

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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