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
64653463456greg
Frequent Visitor

Time between operations

Time between operations.JPG

 I have a table with dates and times (see picture).

The times represent an uptime for a component.

 

What I’d like to do is figure out a way to get a column of the downtime between operations.

 

So, if a part is operational between 10:41 and 11:46 and then again between 12:43 and 13:44. Then what is the downtime between the two operations.

 

 

What I also can’t figure out is how to exclude the times where the part has downtime overnight.

Can I filter that out in some way?

All of this must correspond to a serial number that I have several of in a separate column.

 

Basically:

Serial Number 1

Start Date 1

End Date 1

Start Time 

End Time 

Serial Number 1

Start Date 1

End Date 1

Start Time 

End Time

Serial Number 1

Start Date 1

End Date 1

Start Time 

End Time 

Serial Number 1

Start Date 2

End Date 2

Start Time 

End Time 

Serial Number 1

Start Date 2

End Date 2

Start Time 

End Time 

Serial Number 1

Start Date 2

End Date 2

Start Time 

End Time 

Serial Number 2

Start Date 1

End Date 1

Start Time 

End Time 

Serial Number 2

Start Date 1

End Date 1

Start Time 

End Time 

Serial Number 2

Start Date 2

End Date 2

Start Time 

End Time 

Serial Number 2

Start Date 2

End Date 2

Start Time 

End Time 

And so on, and so on.

 

Any help on the matter is greatly appreciated.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @64653463456greg ,

 

It sounds like you want to subtract the start time of the current row from the end time of the previous row to get the intermediate downtime. Also group by Serial Number.

You could create a calculated column like

previous end time =
MINX (
    FILTER (
        'Table',
        [Serial Number] = EARLIER ( 'Table'[Serial Number] )
            && [End Time] > EARLIER ( 'Table'[End Time] )
    ),
    [End Time]
)

vstephenmsft_0-1652333674927.png

Then create another calculated column to get the time.

Time =
IF (
    NOT ( ISBLANK ( [previous end time] ) ),
    [previous end time] - [Start Time]
)

vstephenmsft_1-1652333892508.png

 

 

 

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

64653463456greg
Frequent Visitor

Thank You Stephen for your answer.

I found another way that worked great as well.

 

What I did was:

Create an Index column.

 

Then based on that I made an “Next start time” table:

 

Next Start Time = IF('Data'[Serial #] = LOOKUPVALUE('Data'[Serial #],'Data'[Index],'Data'[Index]+1),LOOKUPVALUE('Data'[Start Time],'Data'[Index],'Data'[Index]+1),BLANK())

 

Then I made a column based on that for the downtime in minutes:

 

Down Time (Minutes) = (DATEDIFF('Data'[End Time],'Data'[Next Start Time],MINUTE)+0) 

 

This worked great for my need.

Thank you for taking the time and replying, I really appreciate it.

View solution in original post

3 REPLIES 3
64653463456greg
Frequent Visitor

Thank You Stephen for your answer.

I found another way that worked great as well.

 

What I did was:

Create an Index column.

 

Then based on that I made an “Next start time” table:

 

Next Start Time = IF('Data'[Serial #] = LOOKUPVALUE('Data'[Serial #],'Data'[Index],'Data'[Index]+1),LOOKUPVALUE('Data'[Start Time],'Data'[Index],'Data'[Index]+1),BLANK())

 

Then I made a column based on that for the downtime in minutes:

 

Down Time (Minutes) = (DATEDIFF('Data'[End Time],'Data'[Next Start Time],MINUTE)+0) 

 

This worked great for my need.

Thank you for taking the time and replying, I really appreciate it.

Anonymous
Not applicable

Hi @64653463456greg ,

 

Very good approach, if you could, please mark the solution, more people will benefit.😁

 

Best Regards,

Stephen Tao

Anonymous
Not applicable

Hi @64653463456greg ,

 

It sounds like you want to subtract the start time of the current row from the end time of the previous row to get the intermediate downtime. Also group by Serial Number.

You could create a calculated column like

previous end time =
MINX (
    FILTER (
        'Table',
        [Serial Number] = EARLIER ( 'Table'[Serial Number] )
            && [End Time] > EARLIER ( 'Table'[End Time] )
    ),
    [End Time]
)

vstephenmsft_0-1652333674927.png

Then create another calculated column to get the time.

Time =
IF (
    NOT ( ISBLANK ( [previous end time] ) ),
    [previous end time] - [Start Time]
)

vstephenmsft_1-1652333892508.png

 

 

 

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.

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