Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

scolieric27
New Contributor

Need to count values that are contingent on multiple variables

Hi All,

I'm having trouble finding the correct query to write in QlikSense that will provide me with what I'm looking for.

I have a list of patients (encounters) and a count of all of the medications (units_of_service) that they have received throughout their hospital stay; I also have each of those medications (description) divided up into drug class categories (AFHSDescription).

For example: If i filter down into two drug classes (AFHSDescription) I need to get a count of patients who had received medications in BOTH drug categories. Can someone please help with what query I would write in a Qliksense expression to provide the aforementioned request?


Thank you so much!

Tags (1)
1 Reply
YoussefBelloum
Esteemed Contributor

Re: Need to count values that are contingent on multiple variables

Hi,

on a straight table object, choose AFHS Description as DIMENSION, and use this expression:

=if(GetSelectedCount([AFHS Description])>1,

Only({<encounter= {"=COUNT(Distinct [AFHS Description]) = 2"}>}encounter),

Only(encounter))


using this, when you select 2 AFHS descriptions, you will see ONLY references that are attached on BOTH descriptions you have selected..


if it is working for you, you can simply replace only by count

Community Browser