Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
g_dallas
New Contributor

Set Analysis Operators and or or or or whaaat?

Hi nice people,

I have a question regarding set analysis with operators.

I figured out how to use AND & OR Operators... here my simplified solution:

AND (show customer with customerID 1234 that bought Product A):

=SUM({< [CustomerID] = {'1234'}> * < [Product] = {'A'}> }[Values])

OR (show everything that is Product A or Product B:

=SUM({< [Product] = {'A'}> + < [Product] = {'B'}> }[Values])

HOWEVER, when I combine them to select Customer with ID 1234 that bought Product A or Product B something doesn't work out 😉 - what did I do wrong

??? =SUM({< [CustomerID] = {'1234'}> * < [Product] = {'A'}> + < [Product] = {'B'}>}[Values])  ???

 

Can you please help me 🙂 thx

all the best

george

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Set Analysis Operators and or or or or whaaat?

If you want to combine multiple AND's and OR's you need to use appropriate brackets. And this is within a set analysis not different to any other expression, usually applied within if-loops, like:

SUM({< [CustomerID] = {'1234'}> * (< [Product] = {'A'}> + < [Product] = {'B'}>)}[Values])

Whereby if I understand your target right it could be done easier respectively more "classical" in regard to the common used syntax, like:

SUM({< [CustomerID] = {'1234'}, [Product] = {'A','B'}>}[Values])

- Marcus

2 Replies
MVP & Luminary
MVP & Luminary

Re: Set Analysis Operators and or or or or whaaat?

If you want to combine multiple AND's and OR's you need to use appropriate brackets. And this is within a set analysis not different to any other expression, usually applied within if-loops, like:

SUM({< [CustomerID] = {'1234'}> * (< [Product] = {'A'}> + < [Product] = {'B'}>)}[Values])

Whereby if I understand your target right it could be done easier respectively more "classical" in regard to the common used syntax, like:

SUM({< [CustomerID] = {'1234'}, [Product] = {'A','B'}>}[Values])

- Marcus

g_dallas
New Contributor

Re: Set Analysis Operators and or or or or whaaat?

Legend! thank you so much!!!