Skip to main content

Add Additive or Non-Additive Metrics

You can add additive or non-additive metrics to a model by choosing a column in the fact dataset, and choosing a supported aggregate calculation to apply to the data in that column.

Before you start

When using Databricks SQL as a data warehouse, you can use the databricks.estimateddistinctcount.deviation engine setting to specify the maximum relative standard deviation allowed for the approx_count_distinct aggregate function. The default value is 0.02.

Procedure

To add an additive or non-additive metric:

  1. In the Repo Browser, locate the dataset you want to base your metric on, open its context menu and select Create metric. The Edit Metric panel appears.

  2. Complete the following fields:

    • Display name: The name of the metric that appears in BI tools.
    • Unique name: The unique name of the metric. This value must be unique across all repositories and subrepositories.
    • Description: A description of the metric.
    • Dataset: The dataset that contains the source column the metric is based on. This should be the model's fact dataset.
    • Target column: The dataset column the metric is based on.
  3. In the Aggregation type field, select the the aggregate calculation to apply to the data.

    Type of MetricSupported Aggregation Types
    AdditiveAverage Distinct Count Estimate Max Min Non-distinct Count: count non-null Population Standard Deviation: stddev_pop Population Variance: var_pop Sample Standard Deviation: stddev_samp Sample Variance: var_samp Sum
    Non-AdditiveDistinct Count Percentile
note

Note: If you select Percentile and would like to specify a compression factor or a quantile for the metric, you must do so by editing its SML after saving it. For more information, see the AtScale SML Object Documentation on GitHub.

  1. In the Data Handling and Formatting section, enter the following details:

  2. In the Visibility in Published Data Sources section, enable/disable the Include in the list of available metrics option. When enabled, the metric appears in deployed versions of the model.

  3. Click Apply.

The new metric appears in the metrics/ folder of the Repo Browser.