Use LAG to fetch the previous day’s value in the same series. Subtract to get the absolute change, and divide by the lag value to get the percentage growth. Provide a safe default in LAG or guard against division by zero to keep results stable.
Partition the series by entity, like product or region, and order by the date. This produces clean, independent time series with clear comparisons across consecutive points.
Example code
SELECT day, val,
LAG(val,1) OVER (PARTITION BY series_id ORDER BY day) AS prev,
val - LAG(val,1,0) OVER (PARTITION BY series_id ORDER BY day) AS delta,
CASE WHEN LAG(val,1) OVER (PARTITION BY series_id ORDER BY day) > 0
THEN (val - LAG(val,1) OVER (PARTITION BY series_id ORDER BY day))
/ LAG(val,1) OVER (PARTITION BY series_id ORDER BY day)
END AS growth
FROM series;