Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Count one column based on negative values in another column

I know I can count the number of distinct customer numbers where revenue is 0 by this expression:

count({<Revenue={0}>}DISTINCT CustomerNumber)

But I am looking to count where Revenue is less than 0 (negative), but neither of these work:

count({<Revenue<{0}>}DISTINCT CustomerNumber)

count({<Revenue={<0}>}DISTINCT CustomerNumber)

Can someone please explain why those don't work and what the correct way is to do this? How can I filter using numerical comparison operators?

Thank you!

1 Solution

Accepted Solutions
Highlighted
Luminary
Luminary

Re: Count one column based on negative values in another column

Try this:

count({<Revenue={"<0"}>}DISTINCT CustomerNumber)
Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

3 Replies
Highlighted
Luminary
Luminary

Re: Count one column based on negative values in another column

Try this:

count({<Revenue={"<0"}>}DISTINCT CustomerNumber)
Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

Highlighted

Re: Count one column based on negative values in another column

How about this

Count({<Revenue = {"<0"}>} DISTINCT CustomerNumber)

Or may be this if a Customer can have more than one row of Revenue....

Count({<CustomerNumber = {"=Sum(Revenue) <0"}>} DISTINCT CustomerNumber)

 

Highlighted
Contributor III
Contributor III

Re: Count one column based on negative values in another column

Thank you!!