Forum Discussion
Time between operations
- Anonymous4 years ago
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] )Then create another calculated column to get the time.
Time = IF ( NOT ( ISBLANK ( [previous end time] ) ), [previous end time] - [Start Time] )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.
- 4 years ago
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.
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.
Hi 64653463456greg ,
Very good approach, if you could, please mark the solution, more people will benefit.😁
Best Regards,
Stephen Tao