Finally solved my own problem.
1. Created a calculation field that equals "0" or "1" depending on whether the time was after 5pm.
2. Created another calc (date) field to add the result of the above field to the date. If the time was after 5pm the new date field is calculated as the next day.
3. Records are then sorted by the new date field and a summary field contains the total.
It would be simpler to record date and time in a single field of type Timestamp. Then you can perform a find for all records in a given timestamp range or set up a relationship that matches by that range;
MainTable::StartTimeStamp >Transactions::TimeStamp AND
MainTable::EndTimeStamp < Transactions::TimeStamp