Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

set analysis multiple conditions

Hello everyone,

 

I've been struggling with set analysis for some time now so I thought I'd ask you in hope you can help me out.

I need to count the donors who :

- have at least two different donation dates

- max(donation date) within the last 12 months

- last and previous donation must be within last 24 months

- there is a unitnumber available for each donor with the above criteria

 

and I am kinda lost. I have tried several thoughts on this but none works.

 

Thank you in advance,

Ioanna.

 

 

Labels (2)
11 Replies
ioannagr
Creator III
Creator III
Author

So I ended up with this set analysis:

 

count(
{<((aggr(max(donationdate),[bd-blooddonor_id]))>=Addmonths('12/31/2017',-12)*max(donationdate)<=('12/31/2017')*(interval(max(donationdate)-date(max(donationdate,2)),'m')<='24')*(aggr(count({<donationcompleted={'0'}>} distinct donationdate))>='2')>})distinct [bd-blooddonor_id] )

 

but it doesn't work. I could use some help.

Also note that for every donation date I need the donation status to be 0     ( here i am showing, on max date, on the last date before max donation date ). How do i do this? 

 

Also all the above conditions need to happen simultaneously, hence the "*" I used.

ioannagr
Creator III
Creator III
Author

I need to count the donors who :

- have at least two different donation dates and donationcompleted=0 on these dates

- max(donation date) within the last 12 months   and donationcompleted=0 on this date

- last and previous donation must be within last 24 months and donationcompleted=0 on these dates

 

They all need to be met at the same time.

Maybe this? 

 

 

if (donationcompleted={'0'} and sum(aggr(count(distinct(donationdate)), blooddonor_id))>='2' and aggr(max(donationdate),blooddonor_id)<=('12/31/2017') and aggr(max(donationdate),[bd-blooddonor_id]))>=Addmonths('12/31/2017',-12) and (interval(max(donationdate)-date(max(donationdate,2)),'m')<='24'),
count(distinct [bd-blooddonor_id] ))

 

 

 

I need your input please, I'm terribly stuck.