LEAD can be extremely useful when we want to calculate deltas, i.e. differences between two values. A typical example may look like this:
LEAD(Clicks) OVER(ORDER BY Day ASC) AS Lead,
Clicks - LEAD(Clicks) OVER(ORDER BY Day ASC) AS Difference
WHERE WebsiteId = 2;
The above query calculates day-to-day deltas: the last column shows the difference in clicks between the current day and the next day. From a business point of view, this could easily tell us a lot about the website: if the deltas for many rows are positive, and possibly increasing, then the website is expanding. If, in turn, the deltas are mostly negative, we can start to worry about the performance of the website.