How would you calculate month-over-month growth?
intermediateAnswer
Aggregate to month, then use LAG to reach the previous row:
(revenue - LAG(revenue) OVER (ORDER BY month)) / LAG(revenue) OVER (ORDER BY month)
Wrap the division so a zero or NULL prior month does not error — NULLIF on the denominator is the usual guard. Doing the aggregation in a CTE first keeps the query readable.
Related