Forum Discussion

BorisTPL's avatar
BorisTPL
Frequent Visitor
5 years ago
Solved

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...
  • BorisTPL's avatar
    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] + 1

    RETURN

    DATEDIFF (

    'WorkorderRealTime'[TimeStatusChange],


    CALCULATE (
     

    VALUES('WorkorderRealTime'[TimeStatusChange]),

    FILTER ( ALL ( 'WorkorderRealTime' ), 'WorkorderRealTime'[Index] = NextRowIndex), WorkorderRealTime[workorderID] = EARLIER(WorkorderRealTime[workorderID])

    ),

    MINUTE

    )