Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dominicmander
Partner - Creator
Partner - Creator

set modifier problem using ">x<=y"

I'm using set analyis to select a range of numbers in a column.

e.g. with the data:

dimensionmeasure
11
21
31
41
51

sum(measure) = 5

sum({$<dimension={">2"}>}measure) = 3

sum({$<dimension={">2<=4"}>}measure) = 2

... so far so good ...

I am finding that sum({$<dimension={">5<=5"}>}measure) returns 5, not 0, which doesn't make any sense to me logically.

sum({$<dimension={">5"}*{"<=5"}>}measure) returns 0 as expected.


Before considering this bug territory I wanted to check whether anyone has encountered this before? Am I missing something obvious here?


I see the same behaviour in both Qlik Sense and Qlik View

Cheers,

Dominic

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Probably a case where an AND is turned into an OR because the AND doesn't return anything. If you use  <=3>=5 you'll get everything that's not between 3 and 5. That's because an OR would give you and empty set. If you use >=3<=5 an AND is used because otherwise you get an empty set. So, my guess is that >5<=5 also uses an OR because and AND will give you an empty set. And if you want to be silly and actually want an empty set you should do what you did in your last expression.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Probably a case where an AND is turned into an OR because the AND doesn't return anything. If you use  <=3>=5 you'll get everything that's not between 3 and 5. That's because an OR would give you and empty set. If you use >=3<=5 an AND is used because otherwise you get an empty set. So, my guess is that >5<=5 also uses an OR because and AND will give you an empty set. And if you want to be silly and actually want an empty set you should do what you did in your last expression.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Yes, I believe Gysbert is again right, there was a similar discussion few days ago.

Greater than and less than

dominicmander
Partner - Creator
Partner - Creator
Author

OK, I guess I can understand that though it feels a bit arbitrary and inconsistent to reverse operator depending on whether a result is returned or not.

The use case here is that I want to create set modifiers for year-to-date and year-to-go ... If you select the final period of the year then the year-to-go set modifier should indeed return an empty set, because year-to-date = full year. Not sure that's silly but maybe there's a better way to achieve this than my suggestion?