Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis ignores my sub-selection when defined a range of values

Hi,

I defined in the expression to only view a specfic set of data, but I might want to view only a sub-part of the presentation by selecting one (or more) of the possible values. Unfortunately, I don't know how to do this... It always sticks to the selections made in the set analysis expression. Since 'C' is a value of the array 'A,B,C,D,E' I would think this should work?

1.png

Script:

Test:

load * inline [

Name, Salary

A,10

B,20

C,30

D,40

E,50];

Set analysis expression: sum({<[Name]={'A','B','C','E'}>} Salary)

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

In Set Analysis, when you add a filter Name={something}, the equals sign "=" means "replace user selections with this". So obviously any of your selections in the same field will get ignored, or more accurately, replaced with the filter values.

In order to allow both selections, you need to add one of the Boolean operators before the + sign. For example, this should do what you are looking for:

sum({<[Name]*={'A','B','C','E'}>} Salary)

*= means the intersection of user selections with the list of values. So, when nothing is selected, you will get A, B, C, E. If you select one of the four values, you will get just what you've selected.

cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy and Austin, TX!

View solution in original post

6 Replies
sunny_talwar

Try this:

Sum({<[Name] *= {'A','B','C','E'}>} Salary)

swuehl
MVP
MVP

I believe you want to use the intersection operator * here:

sum({<[Name] *= {'A','B','C','E'}>} Salary)

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

In Set Analysis, when you add a filter Name={something}, the equals sign "=" means "replace user selections with this". So obviously any of your selections in the same field will get ignored, or more accurately, replaced with the filter values.

In order to allow both selections, you need to add one of the Boolean operators before the + sign. For example, this should do what you are looking for:

sum({<[Name]*={'A','B','C','E'}>} Salary)

*= means the intersection of user selections with the list of values. So, when nothing is selected, you will get A, B, C, E. If you select one of the four values, you will get just what you've selected.

cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy and Austin, TX!

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

with Sunny and Stefan here, why even bother? 🙂

Colin-Albert

One of Henric's hic‌ recent blogs gave an overview of Set operators

Implicit Set Operators

Not applicable
Author

Wow, what a team!!

Thanks a lot for all the replies! Needless to say, they were all correct!

Unfortunately I can only select one as 'THE' correct answer... but kudos for all of you .

Love this forum and it's members.