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:
-
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.
-
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.
-
In the Aggregation type field, select the the aggregate calculation to apply to the data.
Type of Metric Supported Aggregation Types Additive Average 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-Additive Distinct Count Percentile
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.
-
In the Data Handling and Formatting section, enter the following details:
- Override Default Handling: For information about this field, see About Queries on Dimensions that are Unrelated to One or More Queried Measures.
- Formatting: Select the format for the values. If you select Custom, you must enter a custom data format. For more information, see Formats for Data Values.
-
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.
-
Click Apply.
The new metric appears in the metrics/
folder of the Repo Browser.