Dimensions and metrics
Choose grouping fields and calculations that produce a clear, stable result shape.
Dimensions describe what each row is about. Metrics describe what is calculated for that row.
Dimensions
A dimension references a model field and may define an output alias.
Examples:
countrygroups results by country;plangroups results by subscription plan;occurred_atwith a day bucket groups results by calendar day;- a second dimension can define a series within the first dimension.
Array dimensions can return native arrays or joined text. Joined output uses the configured separator. An object field may be addressed with an explicit dotted path such as device.id. Arrays of objects cannot currently be grouped.
Metrics
Supported aggregations are:
| Aggregation | Meaning | Field required |
|---|---|---|
count | Number of matching records | No |
sum | Total of a numeric field | Yes |
avg | Average of a numeric field | Yes |
min | Minimum field value | Yes |
max | Maximum field value | Yes |
distinct_count | Number of distinct field values | Yes |
Each metric needs an output alias. For example, counting records with alias request_count produces a request_count key in every result row.
Multiple dimensions and metrics
Supported warehouses can execute multiple grouped dimensions and multiple metrics in one definition. This powers stacked, scatter, cohort, and combo visualizations.
Keep result shapes understandable. A very wide combination of high-cardinality dimensions can be expensive and difficult to visualize even when technically valid.
Example definition fragment
{
"dimensions": [
{ "field": "occurred_at", "bucket": "day", "alias": "day" },
{ "field": "plan", "alias": "plan" }
],
"metrics": [
{ "aggregation": "count", "alias": "request_count" },
{ "field": "duration_ms", "aggregation": "avg", "alias": "average_duration_ms" }
]
}