Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
SUM({<condition = {'text'}> + <condtion2 = {'text2'}>}#values)
SUM({<condition = {'text'}> + <condtion2 = {'text2'}>}#values)
Borja
The QlikView Help is always worth checking :
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. |
How about something like:
Sum({<Condition={'text'}> + <Condition2={'text2'}>} Values)
Regards
SKG
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
Thanks it works and save a lot of space!