Skip to main content

Simple metrics

Simple metrics are metrics that directly reference a single measure, without any additional measures involved. They are aggregations over a column in your data platform and can be filtered by one or multiple dimensions.

The parameters, description, and type for simple metrics are:

tip

Note that we use the double colon (::) to indicate whether a parameter is nested within another parameter. So for example, query_params::metrics means the metrics parameter is nested under query_params.

ParameterDescriptionRequiredType
nameThe name of the metric.RequiredString
descriptionThe description of the metric.OptionalString
typeThe type of the metric (cumulative, derived, ratio, or simple).RequiredString
labelDefines the display value in downstream tools. Accepts plain text, spaces, and quotes (such as orders_total or "orders_total").RequiredString
type_paramsThe type parameters of the metric.RequiredDict
measureA list of measure inputs.RequiredList
measure:nameThe measure you're referencing.RequiredString
measure:aliasOptional alias to rename the measure.OptionalString
measure:filterOptional filter applied to the measure.OptionalString
measure:fill_nulls_withSet the value in your metric definition instead of null (such as zero).OptionalString
measure:join_to_timespineIndicates if the aggregated measure should be joined to the time spine table to fill in missing dates. Default false.OptionalBoolean

The following displays the complete specification for simple metrics, along with an example.

metrics:
- name: The metric name # Required
description: the metric description # Optional
type: simple # Required
label: The value that will be displayed in downstream tools # Required
type_params: # Required
measure:
name: The name of your measure # Required
alias: The alias applied to the measure. # Optional
filter: The filter applied to the measure. # Optional
fill_nulls_with: Set value instead of null (such as zero) # Optional
join_to_timespine: true/false # Boolean that indicates if the aggregated measure should be joined to the time spine table to fill in missing dates. # Optional

For advanced data modeling, you can use fill_nulls_with and join_to_timespine to set null metric values to zero, ensuring numeric values for every data row.

Simple metrics example

  metrics: 
- name: customers
description: Count of customers
type: simple # Pointers to a measure you created in a semantic model
label: Count of customers
type_params:
measure:
name: customers # The measure you are creating a proxy of.
fill_nulls_with: 0
join_to_timespine: true
alias: customer_count
filter: {{ Dimension('customer__customer_total') }} >= 20
- name: large_orders
description: "Order with order values over 20."
type: simple
label: Large orders
type_params:
measure:
name: orders
filter: | # For any metric you can optionally include a filter on dimension values
{{Dimension('customer__order_total_dim')}} >= 20
0