Create and manage metrics
A metric is a custom aggregate calculation that can be reused across data elements that share a data source. If you define metrics in data models, datasets, or tables from a connected database or catalog, you can help users perform calculations in a consistent way both easily and efficiently.
This document explains how to create and manage metrics for improved metrics governance. For information about using metrics in workbook data elements, see Use metrics in a workbook.
For more details about metrics, including limitations and best practices, see About metrics.
Metrics for datasets are generally available.
Metrics for data models are in public beta. This documentation describes a public beta feature and is under construction. This documentation should not be considered part of our published documentation until this notice, and the corresponding Beta flag on the feature in the Sigma service, are removed. As with any beta feature, the feature discussed below is subject to quick, iterative changes. The latest experience in the Sigma service might differ from the contents of this document.
Beta features are subject to the Beta features disclaimer.
User requirements
The ability to create and manage metrics in data models requires the following:
- You must be assigned an account type with the Create, edit, and publish datasets permission enabled.
- You must be the dataset owner or be granted Can edit access to the data model.
The ability to create and manage metrics in datasets requires the following:
- You must be assigned an account type with the Create, edit, and publish datasets permission enabled.
- You must be the dataset owner or be granted Can edit access to the dataset.
The ability to create and manage metrics in database or catalog tables requires the following:
- You must be be granted Can use & annotate data access for the specific table, or you must inherit the permission granted at the applicable connection, database or catalog, or schema level.
Work with metrics in data models
This documentation describes a public beta feature and is under construction. This documentation should not be considered part of our published documentation until this notice, and the corresponding Beta flag on the feature in the Sigma service, are removed. As with any beta feature, the feature discussed below is subject to quick, iterative changes. The latest experience in the Sigma service might differ from the contents of this document.
Beta features are subject to the Beta features disclaimer.
Create a metric in a data model
-
Open the data model for editing.
-
Select the data model element that you want to add a metric to.
-
In the editor panel, select the Modeling tab.
If you don't see a Modeling tab, you can also add a metric in the Metrics tab of the Element Properties.
-
In the Metrics section, select + (Add metric).
The Add a metric modal appears.
-
In the Name field, enter a name to use for the metric.
-
In the Description field, enter a description about what the metric does. The description appears when a user hovers over the metric.
-
In the Formula field, define the metric logic. You can use Sigma functions, reference any column in the data model table, or reference another metric.
-
[optional] Turn on the Timeline switch to display a timeline for the metric on the data model overview page.
- For Date, choose a date column in your data to use for the timeline.
- For Truncation, choose a how to truncate the date, or choose to remove the date truncation and use the existing granularity of the date column.
- [optional] For Compare period, choose the comparison period for the metric, or choose None.
- [optional] For Direction, choose the direction for the comparison trend, or choose None.
-
Review the Preview for your metric and optionally define a format for the output of the metric.
For example, you can specify the formula result as a currency or a percentage, set the number of decimal places, or select options from the full format menu by clicking the number format menu (
).
Metrics define aggregate calculations. If the preview displays a null value, your formula might be missing an aggregate function, such as
Sum()
,Avg()
, orCount()
. -
Publish the data model to make the changes available downstream.
Highlight a metric in the data model overview
By default, up to six metrics that you create in a data model appear on the data model overview page. To change which metrics appear, you can choose to highlight specific metrics on the overview page and display only those.
-
Open the data model for editing.
-
Select the data model element that you want to add a metric to.
-
In the editor panel, select the Modeling tab.
-
In the Modeling tab of the editor panel, in the Metrics section, locate the metric.
-
For the metric, click More (
), then select Highlight in overview.
-
Publish the data model to make the changes available.
Highlighted metrics can be explored by anyone with access to the data model. For more details, see Navigate data models.
Edit a metric in a data model
To modify a metric, do the following:
-
Open the data model for editing.
-
Select the table on which the metric is defined.
-
In the Modeling tab of the editor panel, in the Metrics section, locate the metric.
-
Click
(Edit metric...).
-
Make any desired changes, then click Save.
-
Publish the data model to make the changes available downstream.
Columns and metrics that use the metric update to use the revised metric.
Delete a metric in a data model
To delete a metric, do the following:
-
Open the data model for editing.
-
Select the table on which the metric is defined.
-
In the Modeling tab of the editor panel, in the Metrics section, locate the metric.
-
For the metric, click More (
), then select Delete.
-
Publish the data model to make the changes available downstream.
Any columns or metrics that rely on the deleted metric display an error.
Work with metrics in datasets
Datasets and metrics in datasets are generally available.
Create a metric in a dataset
Follow these steps to create a metric:
-
Open a dataset or database table.
-
In the header, click Edit.
-
Select the Metrics tab, then click Create Metric to open the metric builder.
-
In the Name field, enter the name of the metric.
-
In the Description field, enter details about the metric.
This information displays when users apply metrics to a workbook element. -
In the Formula field, define the metric logic.
You can use Sigma functions, and reference any column in the open dataset or database table.
You can also use an existing metric of the dataset; this is a very powerful practice to build reusable calculation components in your dataset.
-
Use the quick formatting tools and preview to customize the metric output.
For example, you can specify the formula result as a currency or a percentage, set the number of decimal places, or select options from the full format menu by clicking the number format menu (
).
Metrics define aggregate calculations. If the metric builder preview returns a
null
value, your formula might be missing an aggregate function, such asSum()
,Avg()
,Count()
, and so on. -
In the header, click Publish to save the metric.
Edit a metric in a dataset
When you edit a metric, Sigma reflects your changes in workbook elements that link to the specific dataset or database table. All workbook references to the metric include name and description changes, and Sigma recalculates metric results based on formula updates.
To edit a metric, follow these steps:
- Open the dataset or database table that contains the metric that you plan to edit.
- Click Edit.
- Select the Metrics tab.
- Locate the metric in the list, and click its name to open the metric in the metric builder.
- Edit the metric name, description, formula, and formatting as needed, then click Publish to update the metric.
Delete a metric in a dataset
When you delete a metric, its calculation becomes invalid in workbook elements. Tables display error messages in columns that previously included metric output. Visualizations and pivot tables display an error message instead of the element.
-
Open the dataset or database table that contains the metric you plan to delete.
-
Click Edit.
-
Select the Metrics tab.
-
In the list of metrics, find the metric that you plan to delete.
-
For the metric, click More (
), then select Delete.
Alternatively, select the metric to open the metrics builder and locate the metric in the side panel. Next to the name of the metric, click Delete metric (
).
Updated 12 days ago