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! Learn more

Reply
azakir
Resolver I
Resolver I

Cumulative Total for timestamp

Hi Guys. 

I have the following situation. I need to get the cumulative based on every hour. My table has time stamp with seconds / minutes, however, my target is for a 12 hour mark. I can divide the total benchmark by 12 and apply a running sum formula, but that does a running sum based on every time stamp. I would like this running sum to be based on every hour: 

 

azakir_0-1726450168970.png

Ideally, I'd like this red line to start from 3635 (43626 / 12) at 6:00PM, incrementing by 3635 every hour and at 6:00AM it should give 43626

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @azakir ,

I create a table as you mentioned.

vyilongmsft_0-1726536777944.png

Then I create some calculated columns and measures.

Here are calculated columns DAX codes:

Hour = HOUR('Table'[Timestamp])
HourlyBin =
'Table'[Timestamp]
    - SECOND ( 'Table'[Timestamp] ) * ( 1 / 86400 )
    - MINUTE ( 'Table'[Timestamp] ) * ( 1 / 1440 )
IncrementPerHour = DIVIDE(43626,12)

Here are measures DAX codes:

TargetRunningSum = 
    VAR StartTime = TIME(18,0,0) 
    VAR CurrentTime = MAX('Table'[HourlyBin])
    VAR _Incremental = MAX('Table'[IncrementPerHour])
    RETURN 
        IF(CurrentTime >= StartTime,
            (DATEDIFF(StartTime, CurrentTime,HOUR)+1) *_Incremental ,
            BLANK()
        )
CumulativeSum = 
    CALCULATE(
        SUM('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[HourlyBin] <= MAX('Table'[HourlyBin])
        )
    )

vyilongmsft_1-1726537117196.png

Finally when you add columns you want, you will see what you want.

vyilongmsft_2-1726537172962.png

vyilongmsft_3-1726537200263.png

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
Anonymous
Not applicable

Hi @azakir ,

I create a table as you mentioned.

vyilongmsft_0-1726536777944.png

Then I create some calculated columns and measures.

Here are calculated columns DAX codes:

Hour = HOUR('Table'[Timestamp])
HourlyBin =
'Table'[Timestamp]
    - SECOND ( 'Table'[Timestamp] ) * ( 1 / 86400 )
    - MINUTE ( 'Table'[Timestamp] ) * ( 1 / 1440 )
IncrementPerHour = DIVIDE(43626,12)

Here are measures DAX codes:

TargetRunningSum = 
    VAR StartTime = TIME(18,0,0) 
    VAR CurrentTime = MAX('Table'[HourlyBin])
    VAR _Incremental = MAX('Table'[IncrementPerHour])
    RETURN 
        IF(CurrentTime >= StartTime,
            (DATEDIFF(StartTime, CurrentTime,HOUR)+1) *_Incremental ,
            BLANK()
        )
CumulativeSum = 
    CALCULATE(
        SUM('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[HourlyBin] <= MAX('Table'[HourlyBin])
        )
    )

vyilongmsft_1-1726537117196.png

Finally when you add columns you want, you will see what you want.

vyilongmsft_2-1726537172962.png

vyilongmsft_3-1726537200263.png

 

 

 

Best Regards

Yilong Zhou

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

Hi @Anonymous This has resolved the issue. Thank you for explaining in such a detail. 

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