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

Set analysis to add selection to pivot table

I am trying to present, in a table, the percentage of patients who have the selected Condition AND each of the other possible Conditions. So, as displayed below, the user has selected 'Asthma' and therefore the table should display the percentage of all patients who have Asthma AND Other mental disorders, Asthma AND Depression, etc. (The percentages in my sample are incorrect.)

Is there set analysis to do this?  Qlik doesn't accept this:

=Count({<[MedDX.Condition]=+p([MedDX.Condition]) >} distinct Recipient_Unique_ID)

/Count({<[MedDX.Condition]=+p([MedDX.Condition]) >} TOTAL distinct Recipient_Unique_ID)

Thanks for your help.

Capture.PNG

1 Solution

Accepted Solutions
ogautier62
Specialist II
Specialist II

Hi,

If I've well understood the model,

you could try something like this :

count({1 <Recipient_Unique_ID =P( {$}) >} distinct MedDX.Condition)

you take all patient selected by current selection ($)

and you count all deseases ( {1}) for those patients

regards

View solution in original post

5 Replies
ogautier62
Specialist II
Specialist II

Hi,

If I've well understood the model,

you could try something like this :

count({1 <Recipient_Unique_ID =P( {$}) >} distinct MedDX.Condition)

you take all patient selected by current selection ($)

and you count all deseases ( {1}) for those patients

regards

Lauri
Specialist
Specialist
Author

Perfect! So simple, so elegant. Thank you, Olivier.

Is it also possible to hide the row for the Condition that the user selects? In the below example, the user has selected 'Obesity' so it is unnecessary to show it in the table (because of course 100% of patients with Obesity have Obesity!). I tried an IF statement in different ways, but all values go to zero or null.

Capture.PNG

ogautier62
Specialist II
Specialist II

I didn't test,

but it could be :

count({1 <Recipient_Unique_ID =P( {$}),MedDX.Condition = E({$}) >} distinct MedDX.Condition)

to add exclusion on desease selected,

regards

good dev

Lauri
Specialist
Specialist
Author

Bravo, you are correct again.

(I have trouble understanding why it works; I would expect the e() function to take the selection out of the calculation for all rows in the table.)

ogautier62
Specialist II
Specialist II

because it's an AND with id = P($) so it takes the intersect and not all rows !