Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression containing ''or''

How could I write the ''or'' condition within an expression.

=sum({<condition={'text'} or condition2={'text2'})>} #values)

The goal is to sum only the values coming from 'text' or 'text2'.

I know how to write it for an ''and'' (just adding "," between both conditions).

Would appreciate any help!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

SUM({<condition = {'text'}> + <condtion2 = {'text2'}>}#values)

View solution in original post

5 Replies
MK_QSL
MVP
MVP

SUM({<condition = {'text'}> + <condtion2 = {'text2'}>}#values)

Anonymous
Not applicable
Author

Borja

The QlikView Help is always worth checking :

Set Operators

There are several set operators that can be used in set expressions. All set operators use sets as operands and return a set as result.

The order of precedence is:

1. Unary minus (complement)

2. Intersection and Symmetric difference

3. Union and Exclusion

Within a group, the expression is evaluated from left to right. Alternative orders can be defined by standard brackets, which may be necessary because the set operators do not commute. For example, A+(B-C) is different from (A+B)-C which in turn is different from (A-C)+B.

Note!
The use of set operators in combination with basic aggregation expressions involving fields from multiple QlikView tables may cause unpredictable results and should be avoided. E.g. if Quantity and Price are fields from different tables, then the expression sum({$*BM01}Quantity*Price) should be avoided.

Arguments:

   

Operator Description
+Union. This binary operation returns a set consisting of the records that belong to any of the two set operands.
-Exclusion. This binary operation returns a set of the records that belong to the first but not the other of the two set operands. Also, when used as a unary operator, it returns the complement set.
*Intersection. This binary operation returns a set consisting of the records that belong to both of the two set operands.
/Symmetric difference (XOR). This binary operation returns a set consisting of the records that belong to either, but not both of the two set operands.
simenkg
Specialist
Specialist

How about something like:

Sum({<Condition={'text'}> + <Condition2={'text2'}>} Values)

Regards

SKG

datanibbler
Champion
Champion

Hi Borja,

I think in a set_expression, you can also just put both possible values (the ones you want to connect with OR) in one pair of curvy brackets, with a comma

=> Sth like >>  sum({<condition = {'text1', 'text2'}>} [field]) <<

HTH

Best regards,

DataNibbler

Not applicable
Author

Thanks it works and save a lot of space!