I have three different scenarios to try and solve a calculation that will give me counts

1. A ticket which opens in a certain queue, moves to another queue and does not return to the original queue. In this example we start in IPS_COAF_CS_SUPPORT, we come back and leave again, but the last queue is not IPS_COAF_CS_SUPPORT

2. A ticket opens and never leaves the queue. In this example the tickets starts in IPS_COHL_LO_SUPPORT and never gets assigned to another queue.

3. A ticket which opens in a queue, then leaves and goes to various other queues and the returns for closure. In this example the ticket starts in IPS_COAF_LO_SUPPORT goes all over the place and comes back to IPS_COAF_LO_SUPPORT.

I am looking for one calculation that will handle all three scenarios and only for certain queues ('IPS_COHL_SERVICING_SUPPORT','IPS_COHL_LO_SUPPORT','IPS_COAF_CS_SUPPORT','IPS_COAF_LO_SUPPORT') and return a count for each (count on IR#)

I must have my requirements wrong. Though this does work, it is not 100% accurate when looking at the data and I have to figure out the NULLs, all of those will goin into one of the 3 scenarios. I do appreciate the help.