Beginner
Date Bucketing in GoogleSQL
Use DATE_TRUNC, EXTRACT, and calendar-safe filters for weekly and monthly reporting.
1SELECT DATE_TRUNC(order_date, WEEK) AS week_start, acquisition_channel, SUM(revenue) AS weekly_revenue,2COUNT(*) AS order_count FROM `analytics.orders` WHERE order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 83WEEK) AND order_date < CURRENT_DATE() AND status = 'completed' GROUP BY DATE_TRUNC(order_date, WEEK),4acquisition_channel ORDER BY week_start DESC, weekly_revenue DESC;5678910111213141516
SEO-friendly learning paths for BigQuery analysts and developers.
Beginner
Use DATE_TRUNC, EXTRACT, and calendar-safe filters for weekly and monthly reporting.
Intermediate
Rank rows, compute running totals, and compare current rows to prior periods.
Practical
Reduce scanned bytes with partitions, selected columns, and bounded date filters.
Fast references for dates, JSON, arrays, and windows.
DATE_TRUNC(order_date, MONTH)
CROSS JOIN UNNEST(items) AS item