Forum Discussion

Vivek2456's avatar
Vivek2456
Frequent Visitor
3 years ago
Solved

Multiple overlapping dates and grouping data based on a flow - Urgent

Hello,

Need urgent help. I am working on the below data with requirements below. Anonymous Pragati @Greg_Deckler

 

Requierement1 - Need to group the cases were the flow of state is from non zero to zero as per ascending order of state time with an ID column. Groups are coloured in different colours. Output shown in Requierement2.

Requirement2 - Identify the groups were state type 1 is included. There can be state type zeros also in this group. Output in Requirement3

Requirement3 - Identify the groups were state is 2 against the first state type 1 in each group.Output in Requirement 4

Requirement4 - For each id get the min of the state_time at the first state type 1 and max of the state time. Output in output5

output5

 

Similar to output5 we will have to repeat the same steps for multiple object ids. Suppose below is the final output I get for each objectid. From here I need to understand which all IDs from each object id overlaps mutually. For example IDs b, y and m will overlap here mutually and I need to find the overlap duration here which is 2:35 - 2:45. In an object ID no IDs will overlap.

Note one ID from object ID can overlap with multiple IDs in Obj ID 2 or 3 and that is making my life difficult. Also more object IDs can get added to this list and I need to find a logic that works without hardcoding them. Please help.

 

5 Replies