6 Replies Latest reply: Oct 16, 2017 5:01 AM by Jonathan Dienst

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

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

• ###### Re: Set analysis filtering

Ok, thanks!

• ###### Re: Set analysis filtering

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

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

• ###### 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?

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