Set modifiers with implicit set operators
The standard way to write selections in a set modifier is to use an equals sign. For example:
Year = {">2015"}
The expression to the right of the equals sign in the set modifier is called an element set. It defines a set of distinct field values, in other words a selection.
This notation defines a new selection, disregarding the current selection in the field. So, if the set identifier contains a selection in this field, the old selection will be replaced by the one in the element set.
When you want to base your selection on the current selection in the field, you need to use a different expression
For example, if you want to respect the old selection, and add the requirement that the year is after 2015, you can write the following:
Year = Year * {">2015"}
The asterisk is a set operator defining an intersection, so you will get the intersection between the current selection in Year, and the additional requirement that the year be after 2015. An alternative way to write this is the following:
Year *= {">2015"}
That is, the assignment operator (*=) implicitly defines an intersection.
Similarly, implicit unions, exclusions and symmetric differences can be defined using the following: +=, –=, /=
Examples: Chart expressions for set modifiers with implicit set operators
Examples | Results |
---|---|
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. |