Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
We value your feedback – take our 5-minute QlikView modernization survey
cancel
Showing results for 
Search instead for 
Did you mean: 
quilldew
Creator
Creator

Nested Set Analysis using P()?

Howdy,

I have an issue where I'm trying to find any patients that have an open referral, that have also had a contact with other particular services, with particular time labels, after their referral date.

I've separated the open referrals by creating a RefClosedDate and having that field = 'NULL' if it's open.

I've tried:

count(
{<
ClientID = P({< Time_Label = {'2 Hours','1 Hour','24 Hours','Trust Default 6 Weeks','48 Hours','1 Working Day','4 Hours'},
Service_Line = {'Alpha','Beta','Delta','Gamma'}
>})
, RefClosedDate = {'NULL'}>}
RefID)

 

but P() treats the ',' as an 'or' if there is more than 1 expression included within it.

So I tried:

count(
{<
ClientID = P({< Time_Label = {'2 Hours','1 Hour','24 Hours','Trust Default 6 Weeks','48 Hours','1 Working Day','4 Hours'}
>})
-
P({< Service_Line -= {'Alpha','Beta','Delta','Gamma'}
>}ClientID)
, RefClosedDate = {'NULL'}>}
RefID)

but that produces totally incorrect data.

 

I will then have to bring in the max contact_date of the resultant ClientID's and compare them with the RefDate's of any other referrals they've had, but I'm way, way, away from that stage.

Is there any other way to nest a set within another set in set analysis?

3 Replies
chrismarlow
Specialist II
Specialist II

Hi,
Is RefClosedDate either a date or null (as in empty) rather than something or the string 'NULL'?
Cheers, Chris.
quilldew
Creator
Creator
Author

Hi,

It's either a date or the string 'NULL'. I created it to avoid having to search for null's using set analysis in my expressions which is a headache.

Brett_Bleess
Employee
Employee

Have a look at the following Design Blog post, and I am including the base link to the Design Blog area below that in case you want to search further on your own, there are quite a few Set Analysis related posts, and after that I am including Help link just in case something there that may help, it is pretty extensive.

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/ChartFunctions/...

Sorry I do not have something better for you, but hopefully this may help you get things figured out.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.