LAG and LEADConcept

Concept

Looking at the neighbouring row

LAG(x) OVER (ORDER BY …) reads the previous row, LEAD(x) the next. Partition by the entity (deal, dashboard) so you never look across entities. First and last rows get NULL: expected, and sometimes the thing you're looking for.

0/5 answered · Enter to check