Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis filtering

Hi,

I have a question about filtering in set analysis.Let's say I have a table with two columns, ProductID and Sales

I create a KPI with the following measure:

Sum({$<ProductID={10}>} Sales)

When no selection is made, it gives 1872.

If I make any selection on ProductID, e.g. ProductID = 3, it is still 1872, while I would expect it to be zero, as all sales with ProductID 10 are supposed to be excluded?

Is this the correct behavior?

No selection:

no_selection.JPG

With selection:

with_selection.JPG

1 Solution

Accepted Solutions
Not applicable
Author

Hi Magnus

Set analysis applies a new selection.

You are forcing the selection to be ProductID 10.

If you would want the selection to change you can just do a SUM(Sales)

Here is a few examples

Set Analysis: syntaxes, examples

Kind Regards

View solution in original post

6 Replies
Not applicable
Author

Hi Magnus

Set analysis applies a new selection.

You are forcing the selection to be ProductID 10.

If you would want the selection to change you can just do a SUM(Sales)

Here is a few examples

Set Analysis: syntaxes, examples

Kind Regards

View solution in original post

Not applicable
Author

Yes the behavior is 100% - sorry - didn't add that in my first reply.

Not applicable
Author

Ok, thanks!

jonathandienst
Partner
Partner

By default, the set expression overrides the manual selection; so this the correct and expected behaviour. You can however, use set operators to change this behaviour.

Sum({$<ProductID += {10}>} Sales)    -- union of the set expression for ProductID and user selections

Sum({$<ProductID *= {10}>} Sales)     -- intersection of set expression for ProductID  and user selections

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
vkish16161
Creator III
Creator III

Jonanthan,


Sum({$<ProductID *= {10}>} Sales)    -- intersection of set expression for ProductID  and user selections


is this similar to and mode in QlikView?

jonathandienst
Partner
Partner

>>is this similar to and mode in QlikView?


No. an intersection is a combination of two expressions, both of which must match. Lets expand the imilicit operator in the expression


    Sum({$<ProductID = {'*'} * {10,20}>} Sales)  // expanded form of *= implicit operator


So the ProductID must exist in the selections and in the list 10,20 to be included in the Sum.


AND mode is different:

AND-Mode

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein