Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Sometimes you need to define a set of field values using a nested set definition. For example, you may want to select all customers that have bought a specific product, without selecting the product.

In such cases, use the element set functions P() and E(). These return the element sets of possible values and excluded values of a field, respectively. Inside the brackets, you can specify the field in question, and a set expression that defines the scope. For example:

P({1<Year = {2021}>} Customer)

This will return the set of customers that had transactions in 2021. You can then use this in a set modifier. For example:

This set expression will select these customers, but it will not restrict the selection to 2021.

These functions cannot be used in other expressions.

Additionally, only natural sets can be used inside the element set functions. That is, a set of records that can be defined by a simple selection.

For example, the set given by {1-$} cannot always be defined through a selection, and is therefore not a natural set. Using these functions on non-natural sets will return unexpected results.

Examples: Chart expressions for set modifiers using set functions

Load script

Load the following data as an inline load in the data load editor to create the chart expression examples below.