Qlik Sense App Development

Contributor

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

Re: set modifier problem using ">x<=y"

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
3 Replies

Re: set modifier problem using ">x<=y"

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
MVP

Re: set modifier problem using ">x<=y"

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

Greater than and less than

Contributor

Re: set modifier problem using ">x<=y"

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?