Dimension
A Dimension represents a computed field at the row level that can be used for grouping or filtering.
Unlike metrics which are aggregates, dimensions are calculated for each row and can be used in GROUP BY clauses or as filter conditions. They allow you to define reusable calculated fields without repeating the logic in every query.
Example
models:
- name: orders
sql: SELECT * FROM orders_table
dimensions:
- name: order_month
expression: "DATE_TRUNC('month', order_date)"
description: "Month when the order was placed"
- name: is_high_value
expression: "CASE WHEN amount > 1000 THEN true ELSE false END"
description: "Whether this is a high-value order"
Attributes
Field | Type | Default | Description |
---|---|---|---|
path | string | None | A unique path to this object |
name | string | None | The unique name of the object across the entire project. |
file_path | string | None | The path to the file that contains the object definition. |
expression | string | None | SQL expression that computes the dimension value for each row. Can reference any field from the parent model. |
data_type | string | None | SQL data type of the dimension (e.g., VARCHAR, INTEGER, DATE). Automatically detected for implicit dimensions extracted from model columns. |
description | string | None | Human-readable description of what this dimension represents. |