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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
cquesenbery
Contributor II
Contributor II

Count formula not working

I need some help - I have tried many versions of   " Count( {<[Total Units] = {“>=1”}>}DISTINCT [PatientID] )" and nothing is working.  My original " Count (DISTINCT [PatientID]) "works but what I would like to do is only count distinct patients if the preceding column (Total Units) is greater than or equal to 1.  What am I missing?  Should I try an if statement?  Thanks CQ

1 Solution

Accepted Solutions
cquesenbery
Contributor II
Contributor II
Author

This is what my chart looks like currently - I would like to only count the distinct patients if the total units are greater than 0 or >=1.

View solution in original post

5 Replies
swuehl
Champion III
Champion III

What do you mean with "preceding column"?

[Total Units] need to be a field in the model if you want it to use like that.

How do the field values of [Total Units] look like? How are the fields related?

What is returned from your expression and what do you expect?

cquesenbery
Contributor II
Contributor II
Author

This is what my chart looks like currently - I would like to only count the distinct patients if the total units are greater than 0 or >=1.

swuehl
Champion III
Champion III

So Total Unit is an expression?

=If("Total Units" >0, Count(DISTINCT PatientID) )

or

If(Column(1) >0, ....)

swuehl
Champion III
Champion III

Or maybe I misunderstood your request?

How does your expression look like?

cquesenbery
Contributor II
Contributor II
Author

That worked - thank you so much for your help!!