Using master measures in expressions
You can use master measures in expressions. You can use the master measure by itself, or use it to build a more complex expression.
When you type in the Expression editor, an auto-complete list of matching master measures opens.
Considerations
When working with master measures, consider the following:
-
If the master measure is renamed or deleted, references in expressions are not automatically updated. The old reference will return NULL in the expression as there is no measure by that name.
Master measure formatting
Number formatting, color, and label can be configured for a master measure. These properties are not applied to a visualization if you reference the master measure using an expression. To apply these properties in a visualization, create a direct link to the master measure when configuring the visualization.
Do the following:
-
Expand Data > Measures in the properties panel.
-
Click Add.
-
In the drop down menu, under Measures, select the master measure.
A direct link is now created to the master measure.
Example: Using a master measure in an expression
This example creates a master measure, and then uses the master measure in a chart expression.
-
Create the master measure.
- Click Master items in the assets panel.
-
Under Measures, click Create new.
-
In the Create new measure dialog box, enter a Name for the master measure, and then click to open the Expression editor.
-
In the Expression editor, create the expression.
You can type the expression, or use the options available in the expression builder panel. For more information, see Working with the expression editor.
Insert the expression using the expression builder Count(distinct item), and then click Apply.
-
In the Create new measure dialog box, click Create.
The new master measure is created.
- Use the master measure in a chart expression.
Add a KPI chart to a sheet in an app.
Click Add measure, and then click to open the Expression editor for the KPI.
Type the master measure into the expression. As you type, you will get an auto-complete list of any available master measures. If required, the master measure can be used to build more complex expressions in the Expression editor.
Close the Expression editor to view the KPI. You can change properties for the KPI, including the label, in the properties panel.