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.

ParameterDescriptionType
nameThe name of the metric.Required
descriptionThe description of the metric.Optional
typeThe type of the metric (cumulative, derived, ratio, or simple).Required
labelRequired string that defines the display value in downstream tools. Accepts plain text, spaces, and quotes (such as orders_total or "orders_total").Required
type_paramsThe type parameters of the metric.Required
measureA list of measure inputsRequired
measure:nameThe measure you're referencing.Required
measure:fill_nulls_withSet the value in your metric definition instead of null (such as zero).Optional
measure:join_to_timespineBoolean that indicates if the aggregated measure should be joined to the time spine table to fill in missing dates. Default false.Optional

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
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
- 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