- Required: FROM · SHOW · GROUP BY · SINCE
- Optional: SEGMENT BY
- Order: FROM → SHOW → GROUP BY → SINCE → SEGMENT BY
Clauses
FROM
- Purpose: Selects the dataset.
- Example:
SHOW
- Purpose: Lists expressions to compute. Typically uses aggregation functions over metrics or fields.
- Examples:
GROUP BY
- Purpose: Defines the grouping keys for aggregation.
- Keys: Can be identifiers, dimensions, or product_attributes.* paths.
- Examples:
SINCE
- Purpose: Defines the time window for the query.
- Accepted forms:
- Relative: -7d, -14d, -30d, -60d, -90d, -180d, -365d, -24h, -48h, -12m, -1y
- Keywords: today, yesterday, this_week, last_week, this_month, last_month, this_quarter, last_quarter, this_year, last_year
- Common rolling windows: past_7_days, past_14_days, past_30_days, past_60_days, past_90_days, past_180_days, past_365_days
- ISO: 2025-03-15 or 2025-03-15T10:30:00Z (timezone offsets supported)
- Examples:
SEGMENT BY (optional)
- Purpose: Adds an additional segmentation dimension applied to each group.
- Examples:
- Identifiers: letters, digits, underscores; start with a letter or underscore.
- Paths: dot notation (for example, product_attributes.color).
- Strings: ‘value’ or “value”
- Numbers: 10, 10.5
- Booleans: TRUE, FALSE