Grouping shift times worked

Hi,

I am trying to group one of our drivers shifts worked. I have calculated the difference between the driver finishing and then starting again to highlight the start of their new shifts. But I need the (far right TEST column) “not” start of new shifts to be grouped to the correct start of shift so that I can aggregate and take the min start time and max end time giving me the full length of the drivers shift.

How could I do this?

I believe I have attached an Easymorph project with a dataset inside containing this data in the screenshot.

GroupingShiftsQuery.morph (4.3 KB)

GroupingShiftsDataset.dset (8.7 KB)