# 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.

[Using master measures in expressions](https://play.vidyard.com/pm3u9tAM7ADLKcmZUK3jYf)

When you type in the Expression editor, an auto-complete list of matching master measures opens.

Master measure in Expression editor

Master measure in Expression editor

Master measure in Expression editor ![Master measure in expression editor.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureAutofill.png)

## 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:

1. Expand Data &gt; Measures in the properties panel.

2. Click Add.

3. 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.

1. Create the master measure.

   1. Click Master items in the assets panel.

   2. Beside Measures, click Create new.

      Create new measure button

      Create new measure button

      Create new measure button ![Create new measure button.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/Sheets/ui_gen_MasterMeasureCreate-saas.png)

   3. In the Create new measure dialog box, enter a Name for the master measure, and then click the Expression icon to open the Expression editor.

      Create new measure dialog box

      Create new measure dialog box

      Create new measure dialog box ![Create new measure window.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureOpenEditor.png)

   4. 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](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Expressions/work-with-expression-editor.htm).

      Insert the expression using the expression builder Count(distinct item), and then click Apply.

      Add expression in Expression editor

      Add expression in Expression editor

      Add expression in Expression editor ![Add expression window.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureInsertExpression.png)

   5. In the Create new measure dialog box, click Create.

      Create measure

      Create measure

      Create measure ![Create measure.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureCreateButton.png)

      The new master measure is created.

      New master measure

      New master measure

      New master measure ![Create variable for master measure.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/Sheets/ui_gen_MasterMeasureCreateButton-saas.png)

2. Use the master measure in a chart expression.

   1. Add a KPI chart to a sheet in an app.

      New KPI

      New KPI

      New KPI![New KPI.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureKPI.png)

   2. Click Add measure, and then click the Expression icon to open the Expression editor for the KPI.

      Open Expression editor

      Open Expression editor

      Open Expression editor![Open expression editor.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureKPIExpression.png)

   3. 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.

      Add expression for KPI

      Add expression for KPI

      Add expression for KPI![Create variable for master measure.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureKPIExpressionEditor.png)

   4. Master measure in KPI

      Master measure in KPI

      Master measure in KPI![Create variable for master measure.](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Resources/Images/ui_gen_MasterMeasureKPIDone.png)

## Learn more

* [Working with the expression editor](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Expressions/work-with-expression-editor.htm)
* [Using expressions in visualizations](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/use-expressions-in-visualizations.htm)
* [Using variables in expressions](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Variables/work-with-variables.htm)