Hi, Thanks for your response. My desired results: Item StartTime EndTime Duration A 02:05:00 02:15:00 00:10:00 B 02:15:05 02:25:05 00:10:00 B 02:40:05 02:45:05 00:05:00 I had tried similar methods like your but got wrong results. Fail duration should be calculated from first fail to first success. Thus actual record count should be 3 instead of 5. Sorting may not be the root cause for my question. It seems that if there are 2 "fail" events, "transaction" commands generates 2 overlapped records. B 02:20:05(fail) 02:25:05(success) 00:05:00 B 02:15:05(fail) 02:30:05(success) 00:15:00 Time duration of first one is included in second one. 02:30:05(success) should not be considered as the end of fail event. 02:25:05(success) is the correct one.
... View more