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

Set analysis with alternate state

Hi

I am trying to generate a dynamic set analysis string based upon users' selections. The two list boxes in fact are the same data with different field names, and one is in NOT state. Is this ok to do it? I know data in Qlik are linked. A set analysis string for default state (it might not be necessary) and Not state are generated respectively and merged in one used in default state.

It looks like the generated set analysis string is correct, but the numbers returned is wrong. I am expecting the following expression returns 3, but it return 4 meaning the E() function is not working. Please advise. Thanks

=count(distinct {(<PatientID=p({<[Disease]={'Diabetes'}>} PatientID)>)*(<PatientID=E({<[Disease]={'CVD'}>} PatientID)>)} PatientID)

Sample project is attached.

Longmatch

18 Replies
baylor2016
Creator
Creator
Author

Genius! Your solution is much simpler, and more efficient!!! Thank a billion.

sunny_talwar

No problem at all

baylor2016
Creator
Creator
Author

One more question, Is this possible to filter conditions in NOT state based upon selections in the Inherited state? For example, when Cancer (Only patient 1 and 3 have cancer) is selected, I only want all other conditions (Diabetes and Hypertension) show up. If there is a easy solution for this, please let me know. Thanks

sunny_talwar

Not sure I understand, would you be able to elaborate on your point above?

baylor2016
Creator
Creator
Author

There are two list boxes for Disease - inherited date and NOT state. Right now all the possible diseases are listed in NOT state. What I want is to limit the diseases in the listbox of NOT state to only include the related disease. Only patient 1 and 3 have Cancer, when Cancer is selected, I only want patient 1's and 3's other conditions (Hypertension and Diabetes) are listed in NOT state listbox. I hope you understand my point now. Thanks

sunny_talwar

Like this?

Capture.PNG

Used this expression for the second list box

=Aggr(Only({1<PatientID = p({$}PatientID)>} Disease), Disease)

baylor2016
Creator
Creator
Author

This is exactly what I want. Thanks.

sunny_talwar

Awesome

baylor2016
Creator
Creator
Author

Hi Sunny,

Could you please look into this post? Somehow the variable for set analysis string is not working. Please advice.

Thanks

Longmatch