Running Revenue Total
Medium · Window Functions
SUM(x) OVER (ORDER BY d) is a running total: for each row it adds up x from the first row up to the current one. It can wrap a normal aggregate, as in SUM(SUM(total)) OVER (ORDER BY day).
For paid orders only, return one row per order date with day (the date), revenue (sum of total that day) and running_total (revenue from the first day up to and including this day). Sort by day.
Next: Day-over-Day Signups