Skip to main content
GROUP BY splits the results into groups and totals each metric within them. List one or more dimensions, separated by commas.
Two dimensions give a breakdown within a breakdown, such as product type within vendor:

Over time

Group by day, week or month to split the results over time, the same as TIMESERIES. It can sit alongside other dimensions:
For patterns within a week or a day, group by day_of_week or hour_of_day.

Top values

TOP n before a dimension keeps its n highest values, ranked by the first metric (or the one in ORDER BY), and puts the rest together in an “Other” row. ONLY TOP n leaves the rest out instead.
On the second of two dimensions, the top values are picked within each value of the first: the top 3 products for each vendor. Add OVERALL after the dimension to pick the top values across the whole report instead.
To keep only the groups whose totals match a condition, use HAVING. To sort them, use ORDER BY.