Defining Metrics
Define Metrics using the console, API, or Terraform.
Key concepts
- Metric type: Defines how the data is aggregated.
- Data Pool: The source of the data for the Metric.
- Dimensions: A set of columns used to categorize and segment the Metric data.
- Filters: A set of filters that define a subset of the Data Pool records to include in the Metric calculations.
Defining a Metric
This example shows how to create a Sum Metric to define a “Revenue” metric by summing the “total_price” column in the TacoSoft sample dataset.
Examples
Example 1: Metrics with filters
This example shows how to create a Sum Metric with filters to define an “Al Pastor Revenue” metric by summing the “total_price” column for Al Pastor tacos in the TacoSoft sample dataset.
Example 2: Metrics with JSON fields
You can use JSON values in the metric definition, either as a measure or as filters.
This example shows how to create a Sum Metric using a measure from a JSON column.
Example 3: Custom Metrics
Custom Metrics use SQL expressions to aggregate data from your Data Pool, enabling more complex business logic.
This example shows how to create a Custom Metric for “Average revenue per order”.
Was this page helpful?