My data contains an ID, status and time(hh:mm:ss).
I need to calculate the total time between every 'Location' and 'Out of tunnel' status
Current table
ID || time || Status
________________________________________________
1 || 08:09:14 || Out of Tunnel
2 || 08:10:59 || Location
3 || 08:11:42 || Out of Tunnel
4 || 08:11:55 || Location
5 || 08:16:36 || Location
6 || 09:41:36 || Location
7 || 09:43:10 || Out of Tunnel
8 || 09:43:19 || Location
The 'Location' status marks where I need to start counting. I need the count to stop the next time the status is 'Out Of Tunnel'. If there is no corresponding 'Out of Tunnel' given, then don't count it.
Each total would then be summed to give a grand total. For example:
- Start at ID2: 08:10:59
- End at ID3: 08:11:42
- Total 1: 00:00:43
- Start at ID4: 08:11:42
- End at ID7: 09:43:10
- Total 2: 01:31:28
- Grand Total: Total1 + Total2 = 01:32:11
Desired output
______________________
| Total Time in Tunnel |
|______________________|
| |
| 01:32:11 |
|______________________|