Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can I use a set analysis to identify a set of IDs that can then be applied as an exclusion on another set?

Hi,

I need to figure out how to remove anyone who meets my criteria as a donor in the current year from a chart of lapsed prior year donors. 

I am able to get an accurate count of both sets using the following expressions:

Current Year Donor:

=Count({$<Year = {$(vMaxYear)}, Segment -= {'Non Donor'} >} Total Distinct([Id Number]))

Prior Year Donor:

=Count({$<Year = {$(vPriorMaxYear)}, Segment -= {'Non Donor'} >} Total Distinct([Id Number]))

What I need to achieve is a set of Prior Year Donors minus Current Year Donors.  Can this be done?  Can I use a set analysis to identify a set of IDs that can then be applied as an exclusion on another set?  Is there another way of thinking about this that works better in Qlik?  I’m open to suggestions here.

Thanks for your help!

Grace

2 Replies
JonnyPoole
Employee
Employee

i'd like to try it on your data but perhaps this..

=Count({$<<Year = {$(vPriorMaxYear)}, Segment -= {'Non Donor'} > - <Year = {$(vMaxYear)}, Segment -= {'Non Donor'} >} Total Distinct([Id Number]))

This should give the fist set of IDs that don't belong to the 2nd set of IDs.

Not applicable
Author

Hi,

I wasn't able to get the above to work, but instead achieved what I needed as a calculated dimension using MAX and IF, and then ultimately AGGR to bring in "Channel" which was the dimension I wanted to see.

=Aggr(if(Sum (Distinct If(Year = (vMaxYear) and Segment = 'Non Donor' , 1,0)) + Sum (Distinct If(Year = (vPriorMaxYear) and [Donor Flag] ='Y' , 1,0)) = 2, Channel), [Id Number])

Then my expressions was a simple count distinct of IDs.  The your suggestions was still very helpful because at least I now know the syntax for subtracting sets, which I'm sure i will need in another context!

Thanks so much for your reply!

Grace