Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
MVP
MVP

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
MVP
MVP

So Total Unit is an expression?

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

or

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

swuehl
MVP
MVP

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!!