I’m building a Diary to determine when someone is working or resting and want to add the time in seconds between entries. There are multiple drivers in the same column
Sample Entries
Date
Driver
Work Rest
Work Rest State
08/05/2017 10:00:00am
Brian
Work
1
08/05/2017 10:01:00am
Brian
Rest
2
08/05/2017 10:30:00am
Evan
Work
1
08/05/2017 10:31:00am
Bill
Work
1
08/05/2017 10:32:00am
Evan
Rest
2
08/05/2017 10:40:00am
Bill
Rest
2
I’d like to calculate Total Seconds Working and Total Seconds Resting as a starting point.
I figure the easiest way would be to look for the date of the persons previous entry and bring the date into the current row and calculate the time difference between the two dates.
I’m not sure how to bring the previous date into the current row. I hope you can help as this is my first post asking as a question.
One thing I would recommend is in the query editor to break out the times from the date column.
To do this you would duplicate the date column and then format it to time.
This way you can more easily calculated on time related data and then also have a column which is just the date and can be connected to you date table via a relationship.
Out of the current columns that you have what are the one which determine the start and end time, to then calculate the totals of working and resting.
To me it’s not so clear at the moment.
Like does this represent that Brian has worked for 1 minute??
I was thinking of breaking out the Date and Time seperately but I’m concerned about how I’d measure between the two time stamps on different days.
You are correct both the start and end time at the moment are in the same column (Date) which is why I think I’ll need to bring the previous one down onto the same row to do the calculation.
That does show that Brian has only worked for 1 minute and is exactly the small amount of time calculations I’ll need to do as well as longer ones that go for several hours over several days for example when someone is not working over a weekend.
This is an interesting one. I don’t quite have the answer yet but you want to actually flip the table somehow so that Work Dates and Rest Dates are in column by themselves.
I tried what you mentioned but it hasn’t worked. Main reason being is because the same Driver logs on and off several times so there is more than one entry to lookup and the search engine gets confused.
Essentially I need to be able to bring down the previous time stamp of the same drivers entry and measure the time duration between the two entries.
Following on from the Work Diary entries once I am able to calculate duration of Work or Rest hours one of the requirements is to be able to calculate if in any period of 5 and half hours a driver has taken a 15 minute break. The 15 minutes need to be continuous rest.
Do you think you might be able to calculate that and show whenever thats not the case?
Are you using different data to what is supplied, because I just took exactly what was placed into the forum. So it’s hard to replicate this at the moment.
What’s different to your data that what I have bee using?
Ok sure thing. Yea it doesn’t need to be exact, but just have included some of the nuances of the data as I’m working on the answers and it’s working for me but seems like it doesn’t reflect well in what you’re actually using.