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

Help with a set analysis expression

Hello.  I have a set analysis statement as seen below.  This works but I really need it to count just these event codes when giving me a distinct count of another field IncidentNumber.  So normally, I would just do a distinct count of the incident numbers for my chart but I needed only a count when the event codes are the ones in the analysis statement below. Can anyone tell me how to write this expression to a distinct count of IncidentNumbers whehn I have just these codes?

Any help is appreciated.  I am new to this.

Count({$<EventCodes ={'AMA/LBTS-Left AMA',

'AMA/LBTS-Left Before TX Start',

'Behavior-Patient',

'Behavior-Physician',

'Behavior-Staff',

'Behavior-Visitor',

'Blood-Adverse Reaction',

'Blood-Related To Time',

'Blood-Wrong Patient',

'Blood-Wrong Type',

'Equip/Product-Malfunction',

'Equip/Product-Sterililzation',

'Equipment/Product-Expired',

'Equipment/Product-Other',

'Fall-Unassisted',

'Fall-With Assistance',

'Medication/IV-Adverse Reaction',

'Medication/IV-AllergicReaction',

'Medication/IV-Documentation',

'Medication/IV-Omitted',

'Medication/IV-Pyxis',

'Medication/IV-Refused',

'Medication/IV-Related to Dose',

'Medication/IV-Related To Order',

'Medication/IV-Related to Route',

'Medication/IV-Related to Time',

'Medication/IV-Wrong Medication',

'Medication/IV-Wrong Patient',

'X/Procedure-Documentation',

'TX/Procedure-Incorrect Count',

'TX/Procedure-Omitted',

'TX/Procedure-Patient Refused',

'TX/Procedure-Related to Order',

'TX/Procedure-Related to Time',

'TX/Procedure-Specimen Lost',

'TX/Procedure-Specimen Mislabel',

'TX/Procedure-UnexpectedOutcome',

'TX/Procedure-Wrong Patient',

'TX/Procedure-Wrong Treatment'}

>}EventCodes)

3 Replies
sunny_talwar

May be this:

Count({$<EventCodes ={'AMA/LBTS-Left AMA',

'AMA/LBTS-Left Before TX Start',

'Behavior-Patient',

'Behavior-Physician',

'Behavior-Staff',

'Behavior-Visitor',

'Blood-Adverse Reaction',

'Blood-Related To Time',

'Blood-Wrong Patient',

'Blood-Wrong Type',

'Equip/Product-Malfunction',

'Equip/Product-Sterililzation',

'Equipment/Product-Expired',

'Equipment/Product-Other',

'Fall-Unassisted',

'Fall-With Assistance',

'Medication/IV-Adverse Reaction',

'Medication/IV-AllergicReaction',

'Medication/IV-Documentation',

'Medication/IV-Omitted',

'Medication/IV-Pyxis',

'Medication/IV-Refused',

'Medication/IV-Related to Dose',

'Medication/IV-Related To Order',

'Medication/IV-Related to Route',

'Medication/IV-Related to Time',

'Medication/IV-Wrong Medication',

'Medication/IV-Wrong Patient',

'X/Procedure-Documentation',

'TX/Procedure-Incorrect Count',

'TX/Procedure-Omitted',

'TX/Procedure-Patient Refused',

'TX/Procedure-Related to Order',

'TX/Procedure-Related to Time',

'TX/Procedure-Specimen Lost',

'TX/Procedure-Specimen Mislabel',

'TX/Procedure-UnexpectedOutcome',

'TX/Procedure-Wrong Patient',

'TX/Procedure-Wrong Treatment'}

>} DISTINCT IncidentNumber)

Not applicable
Author

Thank you.  I will give this a try. Much appreciated.

rupamjyotidas
Specialist
Specialist

The above Equation would work, but since its a very big equation, why not make a flag for all those EventCodes

in your script

if(EvenCodes=X and EvenCodes=y and ...., 1) as FlagEventCodes

So that you equation becomes Simpler

Sum( DISTINCT  {<FlagEventCodes={1}>} IncidentNumber)

It will make your dashboard faster