5 Replies Latest reply: Mar 9, 2017 6:42 AM by Samane Ramezani

# "OR" operator in set analysis

Hi everybody,

I'm new to QV,

In a set analysis, I would like to sum according to conditions that are stocked in two different columns. Let's say column A and B have to be positive

• sum(DISTINCT {<column_A={'>0'}, column_B={'>0'}>} quantity) gives me the quantity if both conditions ar realized

• the * operator seems to work only for conditions within the same column, for instance : column_A={'b' * 'a'}

• sum(DISTINCT {<column_A={'>0'} or column_B={'>0'}>} quantity) seems not to work at all

I have the feeling that this is a very simple problem but looking for "set analysis or" in the forum doesn't help a lot as 'or' is not a very distinctive word...

Someone can give me a hint ?

• ###### "OR" operator in set analysis

The"+"-sign is used for OR in set analysis

• ###### "OR" operator in set analysis

Try this,

if(sum(DISTINCT {<column_A={'>0'}>}quantity) or sum(DISTINCT {<column_B={'>0'}>}quantity),SUM(distinct (quantity)))

it works in my case..

• ###### "OR" operator in set analysis

Had the same question, already posted that but then I saw this reply to a similar question in the forum:

http://community.qlik.com/message/51239#51239

Which implies that your solution would be:

sum(DISTINCT {<column_A={'>0'}> + <column_B={'>0'}>} quantity)