I'm needing to calculate the amount of time that our company trucks are being actively used based off of the driver's actual login times from the dispatch software on their tablets. The problem is the database seems to have multiple records for each time status. I'm not sure why but in the meantime I still need to have an idea of our resource usage. Here is a sample of the data for one driver. I've added column letters and row numbers to help.
A B C D
Date Truck Status Time
1 7/6/2015 D1549 Available 6:58:13
2 7/6/2015 D1549 Break 9:02:21
3 7/6/2015 D1549 Break 9:02:21
4 7/6/2015 D1549 Unavailable 9:17:46
5 7/6/2015 D1549 Unavailable 9:17:46
6 7/6/2015 D1549 Available 9:37:54
7 7/6/2015 D1549 Available 9:37:54
8 7/6/2015 D1549 Unavailable 10:03:06
9 7/6/2015 D1549 Unavailable 10:03:06
10 7/6/2015 D1549 Available 10:11:38
11 7/6/2015 D1549 Available 10:11:38
12 7/6/2015 D1549 Lunch 11:04:16
13 7/6/2015 D1549 Lunch 11:04:16
14 7/6/2015 D1549 Available 12:05:58
15 7/6/2015 D1549 Available 12:05:58
16 7/6/2015 D1549 Break 14:04:12
17 7/6/2015 D1549 Break 14:04:12
18 7/6/2015 D1549 Log Off 16:03:39
19 7/6/2015 D1549 Log Off 16:03:39
So I have two questions. The first is what do I do with the duplicate entries (e.g. rows 2&3, 4&5, etc)? The second, and more important question is how to tally up the actual time in the 'Available' status for each truck? This is a sample from just one truck but we have hundreds and I would like to just sum up the times available. So in this example, I don't necessarily care that the driver took a break at 9:02:21 followed by an undefined 'unavailable' at 9:17:46. I just care about the blocks of time when the truck was being used productively. Jeez. I hope that makes sense. If not ask and I can clarify.
A B C D
Date Truck Status Time
1 7/6/2015 D1549 Available 6:58:13
2 7/6/2015 D1549 Break 9:02:21
3 7/6/2015 D1549 Break 9:02:21
4 7/6/2015 D1549 Unavailable 9:17:46
5 7/6/2015 D1549 Unavailable 9:17:46
6 7/6/2015 D1549 Available 9:37:54
7 7/6/2015 D1549 Available 9:37:54
8 7/6/2015 D1549 Unavailable 10:03:06
9 7/6/2015 D1549 Unavailable 10:03:06
10 7/6/2015 D1549 Available 10:11:38
11 7/6/2015 D1549 Available 10:11:38
12 7/6/2015 D1549 Lunch 11:04:16
13 7/6/2015 D1549 Lunch 11:04:16
14 7/6/2015 D1549 Available 12:05:58
15 7/6/2015 D1549 Available 12:05:58
16 7/6/2015 D1549 Break 14:04:12
17 7/6/2015 D1549 Break 14:04:12
18 7/6/2015 D1549 Log Off 16:03:39
19 7/6/2015 D1549 Log Off 16:03:39
So I have two questions. The first is what do I do with the duplicate entries (e.g. rows 2&3, 4&5, etc)? The second, and more important question is how to tally up the actual time in the 'Available' status for each truck? This is a sample from just one truck but we have hundreds and I would like to just sum up the times available. So in this example, I don't necessarily care that the driver took a break at 9:02:21 followed by an undefined 'unavailable' at 9:17:46. I just care about the blocks of time when the truck was being used productively. Jeez. I hope that makes sense. If not ask and I can clarify.