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.
OpenIn sheetsqlsame section
Count distinct values
Count unique entries in a column.
OpenIn sheetsqlsame section
Get current date and timestamp
Return the current date and current timestamp.
OpenIn sheetsql1 tag match
Extract date parts
Return year, month, day, and other pieces from a date or timestamp.
OpenIn sheetsql1 tag match
Add an interval
Shift a date or timestamp forward or backward.
OpenIn sheetsql1 tag match
Cast timestamp to date
Remove the time portion from a timestamp.
OpenIn sheetsql1 tag match