# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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:

With selection:

1 Solution

Accepted Solutions
Not applicable

## Re: Set analysis filtering

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

6 Replies
Not applicable

## Re: Set analysis filtering

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

Not applicable

## Re: Set analysis filtering

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

Not applicable

Ok, thanks!

MVP

## Re: Set analysis filtering

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
Contributor III

## Re: Set analysis filtering

Jonanthan,

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

is this similar to and mode in QlikView?

MVP

## Re: Set analysis filtering

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