Docs

GROUP BY

Last updated: 27 Oct 2026

GROUP BY splits the result into one row per value of the dimensions and time dimensions you list. Each row has its own metrics, computed from that row's data alone. Grouped dimensions come first in the result, before the metrics.

GROUP BY <dimension or time dimension>, …

Only combinations that have data become rows. A month with no sales has no row. For an unbroken series with zeros, use TIMESERIES.

Group by dimensions

Each schema page lists its dimensions.

Tickets by activity and ticket type

FROM activities
  SHOW tickets_sold, activity_revenue
  DURING last_month
  GROUP BY activity, activity_variant

Lead time and length of stay by channel

FROM bookings
  SHOW bookings, avg_lead_time_days, avg_length_of_stay
  DURING last_year
  GROUP BY channel

Group by time

Time dimensions split the time axis into periods.

Time dimensionOne row perComes back as
daydaythe date
weekISO week, Monday to Sundaythe date of its Monday
monthmonththe first day of the month
quarterquarterthe first day of the quarter
yearyear1 January
day_of_weekweekday, across weeks1 (Monday) to 7 (Sunday)
week_of_yearISO week number, across years1 to 53
month_of_yearmonth, across years1 (January) to 12

Revenue by month and category

FROM revenue
  SHOW net_revenue, vat_amount
  DURING last_quarter
  GROUP BY month, revenue_category

Which weekdays fill up

day_of_week puts every Monday in the range in one row, every Tuesday in the next, and so on.

FROM rooms
  SHOW occupancy, adr
  DURING last_quarter
  GROUP BY day_of_week

The same week across years

FROM rooms
  SHOW room_nights_sold, adr
  WHERE week_of_year = 42
  SINCE 2023-01-01
  GROUP BY year

Metrics that can't split every way

A metric can only split or filter by dimensions that make sense for it. Occupancy has no channel, because an empty room wasn't sold through one:

FROM rooms
  SHOW occupancy
  DURING last_month
  GROUP BY channel

Each schema page says which dimensions such metrics split and filter by. Time dimensions work with every metric.