Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Jorich919
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
treysmithdev
Partner Ambassador
Partner Ambassador

Try this:

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

View solution in original post

3 Replies
treysmithdev
Partner Ambassador
Partner Ambassador

Try this:

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

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)

 

Jorich919
Contributor III
Contributor III
Author

Thank you!!