Roll up metrics by calendar day.
Section: Advanced Aggregation
Aggregate by date
sql
sql
SELECT CAST(created_at AS DATE) AS day, COUNT(*) AS total
FROM events
GROUP BY CAST(created_at AS DATE)
ORDER BY day;Explanation
Very common for dashboards and time-series summaries.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Advanced Aggregation
Conditional aggregation with CASE
Compute multiple categorized totals in one query.
Get current date and timestamp
Return the current date and current timestamp.
Extract date parts
Return year, month, day, and other pieces from a date or timestamp.