Lesson 10.1 · Pro

LAG and LEAD: look at the previous or next row

Compare each row with the one before or after it, like this month vs last month.

In this lesson

  1. LAG gets the previous row's value
  2. LAG within each group
  3. LEAD gets the next row's value