Forum Discussion
BorisTPL
5 years agoFrequent Visitor
Calculating difference in time in different rows
Hi all, I need some help with my calculation of the lead time for our shop. I have different date/time values for certain status updates and want to find the time difference between te statusses with...
- 5 years ago
So if anyone ever needs it: I fixed it by creating an index column per workorderID and used the following code:
Duration In Minutes =VAR NextRowIndex = 'WorkorderRealTime'[Index] + 1RETURNDATEDIFF ('WorkorderRealTime'[TimeStatusChange],CALCULATE (VALUES('WorkorderRealTime'[TimeStatusChange]),FILTER ( ALL ( 'WorkorderRealTime' ), 'WorkorderRealTime'[Index] = NextRowIndex), WorkorderRealTime[workorderID] = EARLIER(WorkorderRealTime[workorderID])),MINUTE)
BorisTPL
5 years agoFrequent Visitor
So if anyone ever needs it: I fixed it by creating an index column per workorderID and used the following code:
Duration In Minutes =
VAR NextRowIndex = 'WorkorderRealTime'[Index] + 1
RETURN
DATEDIFF (
'WorkorderRealTime'[TimeStatusChange],
CALCULATE (
VALUES('WorkorderRealTime'[TimeStatusChange]),
FILTER ( ALL ( 'WorkorderRealTime' ), 'WorkorderRealTime'[Index] = NextRowIndex), WorkorderRealTime[workorderID] = EARLIER(WorkorderRealTime[workorderID])
),
MINUTE
)