The expression editor is where you create expressions that are used for making calculations based on the data in the app.
You open the Add expression or Edit expression dialog by clicking Open Expression editor (). This button is available for many options in the properties panel, and when creating dimensions or measures.
The following image illustrates the Expression editor with the Fields section open, the Distinct and Total options enabled, and an expression inserted in the expression field.
A: Expression field
In the expression editor, you can enter an expression by typing in the expression field. When you type the name of a function in the expression, a tooltip appears that provides information to help you enter the function correctly, including argument names and qualifiers.
For more information, see Set analysis.
B: Fields section
Select a field from a specific table and a common aggregation function to generate some common expressions to be inserted into the expression editor. You can also select system fields.
To learn more about system fields, see System fields.
C: Clauses and set expressions
Some aggregation functions might require a distinct clause or a total clause. Use the check box for each clause to insert it in the aggregation function. Each clause can be used independently.
Use the Set Expression check box to insert your current selection as a set expression in your aggregation. The current selection inserted will always be based on the default state. If you want to create an expression based on an alternate state use the Set Expressions section instead.
To learn more about how to use these set expressions, see Set modifiers.
To learn more about alternate states see Using alternate states for comparative analysis.
D: Functions section
Select a function from a specific category to insert it into the expression editor. You can use functions to generate more complex expressions. A small syntax template shows you how each function is used.
For more information, see Script functions.
E: Set expressions section
Select whether you want to insert the current selection or a bookmark as a set expression. If available, you can choose which alternate state to base the current selection or the bookmark on.
F: Variables section
Select variables and insert them in your expressions. If available, a definition and the value of each variable is shown. You can also choose to include system variables.
For more information, see Using variables in expressions.
G: Dollar-sign expansion preview
Expressions often use dollar-sign expansions, containing expressions with a leading equals sign or variables. The expression is expanded and its result appears in the preview. This allows you to confirm that any dollar sign expansions inside your expression are correct.
For more information, see Dollar-sign expansions.