Growth questions compare a period with an earlier one: month over month (MoM) or the same month last year (YoY). Two tools do it:
LAG(value) OVER (ORDER BY month) for the previous row, which is right only if every month has a row;
- a self join on the period, such as
ON this.month = last.month AND this.year = last.year + 1, which matches the calendar even when months are missing.
Percent change is (this - before) / before * 100. Two edge cases break it: a missing earlier period (NULL, which is honest) and a zero base, which would divide by zero. Guard the divisor with NULLIF(before, 0) so the change comes out NULL instead of failing.
When months can be missing, build a date series first so every month exists, then compare. Otherwise LAG will happily compare March with January and call it month over month.