3 Replies Latest reply on Dec 28, 2015 12:48 PM by Anna Lytvyn

    Help Needed Time Difference

    David Cunliffe

      I hope I explain myself well here as this is the first time utilizing the community as you all have been such a great benefit to myself. My current issue is this; I'm utilizing a small subset of data currently I want to compare two values and get the time difference between them. I may be over thinking this but I've been racking my head against the wall over this for the past 2 days and looked everywhere.


      Here is the example I'm working with



      as you can see in the above picture I'm grouping by Vehicle ID my end goal is to look at the IN SERVICE TIME and the OFF DUTY TIME and have tableau do one of the following. If there is a IN SERVICE TIME then take the time and check for OFF DUTY TIME if none is available take IN SERVICE TIME and END OF DAY (ex 12/1/2015 11:59:59PM) and use a datediff per hour /60 so I can get the minutes overlapping the hour base. If END OF DAY or OOS MECHANICAL then datediff from START OF DAY (12/1/2015 12:00:00AM) I've done these calculations in another sheet the issue I can't figure out is the following if IN SERVICE and OFF DUTY or OOS MECHANICAL are in the same day then I want to see if IN SERVICE is before or after OFF DUTY/OOS MECHANICAL and have it date diff between those times. I'm having a hard time because they are two separate records and I can't seem to figure out how to have it look at both of those after it has ran through all the records or there is a way to do so.