it would be helpful if you could post some lines of sample data together with your expected output, because I haven't understood your requirement completely, so I can't tell if your statement is right or wrong. I only noticed that under ceratin conditions, it looks like you add the count of distinct states to the count of distinct tickets, is this what you want?
As swuehl already said, its hard to understand how you want your expression to function. However maybe the problem is your condition? Since logical AND is evaluated before logical OR the condition that city='FT'/'RT' is not vaild for thw whole condition.
For example, your first condition is true if any of the following is true: (city='FT' and name='Cancelled') or (name <> 'Failed' and D_I<>'D' and comp<>'19').
Thats my only guess using the information you provided.