Create and manage metrics

Metrics are custom aggregate calculations that you can reuse across data elements that share a data source (dataset or database table). Define metrics at the data source level to promote consistent metric logic across elements and help users perform standard calculations with ease and efficiency.

This document explains how to create and manage metrics for improved metrics governance. For information about applying metrics to workbook data elements, see Use metrics in a workbook.

User requirements

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 dataset permission.

The ability to create and manage metrics in database tables requires the following:

  • You must be be granted Can use & annotate data permission for the specific database table, or you must inherit the permission granted at the applicable connection, database, or schema level.

About metrics

Metrics vs. calculated columns

Metrics differ from calculated columns in a dataset. Calculated columns use static calculations to produce static unaggregated values for individual (ungrouped) table rows, or for aggregated values at specific static grouping levels.

In contrast, the metric is a dynamic and reusable calculation that provides aggregated values for any grouping level.

When you add a calculated column to a data element, you define its calculation logic. Metric logic definition resides in the data source; you can reuse it in any element that references the dataset or the database table.

If standard calculation logic changes, you must individually edit calculated columns in all applicable elements. If metric logic changes, updating the metric formula in the data source results in an  automatic recalculation of metric result in all client elements of the metric.

Stacked metrics

When defining a new metric, you can use an existing metric in your formula. This is a very powerful practice to build reusable calculation components. Whenever you change the metric definition, updating its formula automatically updates its output values and the output values of every metric that includes the original metric in its calculation.

Metrics support a single data source

You can only define metrics in a data source. If the same metric logic applies across your organization, or across multiple data sources, you must define the metric again, in each applicable dataset and database table.

No inheritance between datasets

If you create a new dataset from a data source that has metrics, the new dataset doesn’t inherit the existing metrics. You must, instead, create new metrics if the new dataset requires metric logic.

Limited propagation

Similarly, the lineage of metrics persists for two child levels downstream.

No support for window functions

Metric formulas don't support window functions, which use values from multiple rows to return a value for each row.

Create a metric

Follow these steps to create a metric:

  1. Open a dataset or database table.

  2. Click Edit in the header.

  3. Select the Metrics tab.

  4. Click Create Metric to open the metric builder.

  5. Create the metric with the following field values:

    1. In the Name field, enter the name of the metric.

    2. In the Description field, enter details about the metric.
      This information displays when users apply metrics to a workbook element.

    3. In the Formula field, define the metric logic.

      You can use Sigma’s 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.

    4. 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, icon-number-format-menu.svg.

      Metrics define aggregate calculations. If the metric builder preview returns a “null” value, your formula may be missing an aggregate function, such as Sum(), Avg(), Count(), and so on.Total 

    5. In the header, click Publish to save the metric.

Edit a metric

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:

  1. Open the dataset or database table that contains the metric that you plan to edit.
  2. Click Edit.
  3. Select the Metrics tab.
  4. Locate the metric in the list, and click its name to open it in the metric builder.
  5. Edit the metric name, description, formula, and formatting as needed, then click Publish to update the metric.

Delete a metric

When you delete a metric, its calculation becomes invalid in workbook elements. Tables display error messages in columns that previously produced metric output. Visualizations and pivot tables display an error message instead of the element.

  1. Open the dataset or database table that contains the metric you plan to delete.

  2. Click Edit.

  3. Select the Metrics tab.

  4. In the list of metrics, find the metric that you plan to delete.

  5. Click the () action icon of the metric, and select Delete.

    Alternatively, select the metric to open the metrics builder, locate the metric in the side panel, and click the Delete metric icon next to the name of the metric.

Related resources