Fantastic! There is also another version of
LEAD. It takes two arguments:
LEAD(x, y). The
x argument remains the same – it specifies the column to return. The
y argument is an offset – it defines how many rows we will use (going forward from the current row). For instance:
LEAD(OpenDate,2) OVER(ORDER BY OpenDate ASC) AS Lead
This form of
LEAD() won't show the webpage that has the opening date immediately after the current opening date. Instead, it will show the opening date two rows ahead – the first row will show the third date, etc. It's offsetting the result by two rows.