Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
siva_boggarapu
Creator II
Creator II

Set Analysis for getting the Minus count for two values!

Dear Members,

Could anyone will help with writing the Set Analysis for getting the Minus count for two values! Suppose I have two

if(OW_RT = 'OW' and Ticket_status_name <> 'Cancelled' or Ticket_status_name <> 'Failed'

  and COMP = '19',count({$<TKT_TYPE={'ETK','TKT'}> }DISTINCT TICKET)))

In the count ({$<TKT_TYPE={'ETK','TKT'}> }-I want to deduct the TKT_TYPE={'CRN'}.

Can anyone tell me how can we do this.

Thanks & Regards.

SIva

2 Replies
Not applicable

If I understand correctly...

try this:     Count({$<TKT_TYPE = {'ETK', 'TKT'}, TKT_TYPE -= {'CRN'}>} DISTINCT TICKET)

this will show a red line under the -= as if there is an error but should work and will exclude the CRN from that count

swuehl
MVP
MVP

I am also not sure if I understood, I assume you want to count the tickets of type ETK or TKT and then deduct the the count of tickets of type CRN:

count({$<TKT_TYPE = {'ETK','TKT'}>} DISTINCT TICKET ) - count({$<TKT_TYPE = {'CRN'}>}DISTINCT TICKET )

I believe this is different from just creating a selection in TKT_TYPE with values ETK and TKT, removing CRN from that selection, and then count the TICKETS associated to this set (I do believe you actually don't need the TKT_TYPE -= {'CRN'} part in the set expression, since this set element value is implicitely excluded with the first set element anyway).

Say you have 9 balls, 3 red, 3 green, 3 yellow, with distinct ball number. My above expression will return count( Red + green balls) = 6 and deduct 3 yellow balls, so you get a result of three. While I see no way to create one single  set that will result in the difference of the count of two sets with out actually performing the counts (e.g. I think the result of zack.lore's expression in my example would be 6).

But maybe I just don't understand your setting or requirement correctly, so please just comment on this.

Regards,

Stefan