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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count If less than/equal to issue

I always struggle with a "countif" setup in Qlikview -- it's one of the few things that Excel or Numbers are far better at.

I am trying to count cases if the calculated variance is <= 0.

I created a variable "StartVariance" (one date/time subtracted from another date/time) -- and on my straight table, it shows the expected results.

Ultimately, I need to calculate the percentage of cases that have a variance of 0 or less than 1 (meaning we started on time or early).  But I need the count of those cases first.

I searched and found this option:

     count({StartVariance=["<=0"]>} DISTINCT CASE_COUNT)

It gives me the result "1" -- it should tell me 46

If I take out the DISTINCT, it just gives me the total number of cases. 

I've attached a file with the data pertinent to this expression.

Ideas?  Solutions?

Thanks!  Chris

6 Replies
sunny_talwar

May be this

Count({<StartVariance = {"<=0"}>} CASE_COUNT)

Anonymous
Not applicable
Author

no, changing the type of brackets doesn't make a difference. 

gballester
Creator
Creator

I attached an example of how to perform the calculations

Anonymous
Not applicable
Author

I'm not sure exactly how you did this, as I can't select the "frequency" if I'm using an expression variable (instead of a pre-defined variable name).  And it doesn't really answer my question, unfortunately.

gballester
Creator
Creator

= count({<Variance={ "<=1"}>} Variance)

= count({<Variance={ "<=1"}>} distinct Variance)

Anonymous
Not applicable
Author

count(if(Variance<=0,Variance))  or  count({<Variance={"<=0"}>} Variance)