Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Greater than and less than

Hi all,

I am trying to understand how greater than and less than work.

Field1

-1

4

5

6

11

Expression1= count({<[field1]={'<10>0'}>} [field2]) =3

Expresion2= count({<[field1]={'>10<0'}>} [field2]) =2

It seems like Expression1 looks at the 5 available options, removes the value that is greater than 10, and that leaves -1,4,5,6.  It then appears to use those and evaluates those to see which ones are greater than 0 and that leaves 3 remaining values.  This does not appear to be an OR statement.

It seems like Expression2 is an OR statement.  If the value is greater than 10 or less than 0 then count.  Expression2=2.

Why does the one seem to behave as an OR statement and not the other?

Thanks for the help!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Gysbert is absolutely right about this not well discussed and even less documented behaviour of the numeric search.

I've only found

Re: compare a dollar amount &lt;&gt; 0

I just want to emphasize on my last statement therein:

"And one needs to consider this if the search limits are not literals, but dynamically derived from other fields etc.

(For example when you expect always StartTime < EndTime, but when your data proves something else...)"

Due to the behaviour of numeric search, unintentionally mixed up limits might lead to unexpected, incorrect (compared to your requirements) aggregation results.

View solution in original post

4 Replies
Not applicable
Author

Try changing Expreson2 to Expression2 for ur variable?

Just a thought after looking,

Might not fix it but I'm not looking at the data

Seems like it might have been overlooked,

Let me know if I can help further,

Tom

Gysbert_Wassenaar

Yeah, that's the way numeric search works. In the first expression it's an AND because an OR wouldn't make sense. You'd select everything. In the second expression it's an OR. Again because an AND wouldn't make sense. You'd get no results at all.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Gysbert is absolutely right about this not well discussed and even less documented behaviour of the numeric search.

I've only found

Re: compare a dollar amount &lt;&gt; 0

I just want to emphasize on my last statement therein:

"And one needs to consider this if the search limits are not literals, but dynamically derived from other fields etc.

(For example when you expect always StartTime < EndTime, but when your data proves something else...)"

Due to the behaviour of numeric search, unintentionally mixed up limits might lead to unexpected, incorrect (compared to your requirements) aggregation results.

MarcoWedel

Hi,

maybe using expression search helps to explicitly define the expected logical operator:

field1={"=field1<10 and field1>0"}


field1={"=field1>10 or field1<0"}

QlikCommunity_Thread_247029_Pic1.JPG

QlikCommunity_Thread_247029_Pic2.JPG

regards

Marco