Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
drohm002
Creator II
Creator II

difficult question/remove duplicates

Hi,

I have two fields, fieldX with values of 1 and 0, and fieldY with values of 1 and 0.

I want to count how many instances a patient had X.

I want to count how many instances a patient had Y.

And I want to count how many instances a patient had X and Y.

Any ideas?

Thank you

3 Replies
drohm002
Creator II
Creator II
Author

My problem is, I keep double counting the variables and i need help not to do that....I want to create a variable that gives me one number, for those three instances above!

ychaitanya
Creator III
Creator III

Have you tried normal set analysis

Count( {<FieldX= {"1"}>}ID) to calculate no.of instances of X

Count( {<FieldY= {"1"}>}ID) to calculate no.of instances of Y

Count( {<FieldX= {"1"}, FieldY={"1"}>}ID) to calculate no.of instances of X and Y

MarcoWedel

Hi,

maybe some solutions could be:

QlikCommunity_Thread_295941_Pic1.JPG

QlikCommunity_Thread_295941_Pic2.JPG

QlikCommunity_Thread_295941_Pic4.JPG

QlikCommunity_Thread_295941_Pic3.JPG

tabPatient:

LOAD RecNo() as PatientID,

    Round(Rand()) as X,

    Round(Rand()) as Y

AutoGenerate 30;

tabFieldTemp:

CrossTable (Field,FieldValue)

LOAD PatientID,

    X,

    Y

Resident tabPatient;

tabField:

LOAD PatientID,

    Field

Resident tabFieldTemp

Where FieldValue=1;

DROP Table tabFieldTemp;

hope this helps

regards

Marco