Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tresesco
MVP
MVP

negation operator ~ in set anlysis

Hi all,

Negation operator ~ is not working in set analysis for me. Is it a common problem or its an error

from my end ?

i am using SUM( { $ < ~Name = { Amit } > } Sales) to calculate the total sales for current selection

but forcefully excluding the Sale for the Name "Amit".

But it's not working!

Any input is appreciated .

With Regards,

tresesco

7 Replies
Not applicable

Hi

You can try this :

SUM( { $ < Name = -{ Amit } > } Sales)

Not applicable

Hi,

the correct syntax are:

Sum({$<Country-={GERMANY}>}LineSalesAmount)

Good luck!

Rainer

tresesco
MVP
MVP
Author

Thanks guys for your inputs. I knew that the alternatives. But the question is, "~" operator is not working. Is it so, that it does not work in QV? Can someone please confirm it?

Not applicable

That´s what QV help says:

Set Operators

Several set operators that can be used in set expressions exist. All set operators use sets as operands, as described above, and return a set as result.

+ 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.

The order of precedence is 1) Unary minus (complement), 2) Intersection and Symmetric difference, and 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 since the set operators do not commute, e.g. A+(B-C) is different from (A+B)-C which in turn is different from (A-C)+B.

That´s it.

Rainer

tresesco
MVP
MVP
Author

Hi Rainer,

QV help even says this:

sum( {$<~Ingredient = {"*garlic*"}>} Sales )
returns the sales for current selection, but with a forced exclusion of all Ingredients containing the string 'garlic'.

WHAT ABOUT THIS?

Not applicable

In this case it´s a question to ask QT support.

Not applicable

As explained by the marvellous Mr Witherspoon over in

http://community.qlik.com/message/77207

the ~ only applies to fields in 'and-mode' whatever that is..