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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
clt1dxd
Contributor II
Contributor II

Measure is not evaluating

I have a measure that creates a flag (1 or 0) when the discharge_phq score is 50% or less than the admit_phq score.

clt1dxd_1-1724095001881.png

I then have a second measure to sum the flag field 'phq_50'.  

I use this expression - if([phq_50]='1',count(distinct [Patient IMREDEM]),99)   

Note -  [Patient IMREDEM] is a unique field in each row.

In the example above, I would expect the result to be 3, but the result is always the else '99'.  The expression doesn't seem to be evaluating the flag field.

Seems simple enough, but I have tried several things to no avail.

Labels (1)
5 Replies
Digvijay_Singh

Where do you need to use your 2nd measure? I guess you want to use that in KPI but not sure? I suggest you should improvise the 1st measure to get what you want in 2nd measure.

e.g. Sum(Aggr(first measure),dimensionfield)

clt1dxd
Contributor II
Contributor II
Author

Thanks, yes, the 2nd measure is for KPI.

I tried this as well - If((admit_phq-discharge_phq) >= (admit_phq/2), count([Patient IMREDEM]),99)

That didn't work either.  I do not understand your example.

Digvijay_Singh

Whats the logic of 99 else value. if you just want to count 1's when condition is true, you can use

Sum(If((admit_phq-discharge_phq) >= (admit_phq/2), 1)

Digvijay_Singh

OR

Count(If((admit_phq-discharge_phq) >= (admit_phq/2), [Patient IMREDEM])

clt1dxd
Contributor II
Contributor II
Author

Thanks so much for the suggestions.  I tried both, separately, of course.  They both are error free, but they produce the same result.

Sum(If((admit_phq-discharge_phq) >= (admit_phq/2), 1))
Count(If((admit_phq-discharge_phq) >= (admit_phq/2), [Patient IMREDEM]))

 

clt1dxd_0-1724150629733.png

It just doesn't seem to be evaluating the expression correctly.  I am at a total loss.