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:
Note that we use dot notation (.) to indicate whether a parameter is nested within another parameter. For example, measure.name means the name parameter is nested under measure.
| Loading table... |
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
Related docs
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.