Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
naveenchellaara
Contributor III
Contributor III

-= operator

what is the "-=" used for? can anyone please let me know its usage?

Thanks in advance

Naveenchellaaraam.D

2 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

-= is used to exclude the values from the current selections.

Year     Sales

2010     100

2011     200

2012     300

2013     400

For example 2010, 2011 and 2012 are selected then using the below expression

=Sum({<Year-={2011}>} Sales)

The above expression with exclude 2011 from the current selection and return 400 (100 + 300) instead of 600(100 + 200 + 300).

Regards,

Jagan.

swuehl
MVP
MVP

From the HELP:

Set Modifiers Using Assignments with Implicit Set Operators

The above notation defines new selections, disregarding the current selection in the field. However, if you want to base your selection on the current selection in the field and add field values, e.g. you may want a modifier <Year = Year + {2007, 2008}>. A short and equivalent way to write this is <Year += {2007, 2008}>, i.e. the assignment operator implicitly defines a union. Also implicit intersections, exclusions and symmetric differences can be defined using “*=”, “–=” and “/=”.

Examples:

sum( {$<Product += {OurProduct1, OurProduct2} >} Sales )
returns the sales for the current selection, but using an implicit union to add the products “OurProduct1” and “OurProduct2” to the list of selected products.

sum( {$<Year += {“20*”,1997} – {2000} >} Sales )
returns the sales for the current selection but using an implicit union to add a number of years in the selection: 1997 and all that begin with “20” – however, not 2000. Note that if 2000 is included in the current selection, it will still be included after the modification. Same as <Year=Year + ({“20*”,1997}–{2000})>

sum( {$<Product *= {OurProduct1} >} Sales )
returns the sales for the current selection, but only for the intersection of currently selected products and the product “OurProduct1”.