Compute cumulative revenue by day.
Section: window functions
Calculate a running total
sql
sql
SELECT
order_date,
daily_revenue,
SUM(daily_revenue) OVER (ORDER BY order_date) AS running_revenue
FROM daily_order_metrics;Explanation
Window functions let you keep row-level detail while adding cumulative calculations.
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 window functions