Skip to content
SNOWGLOBE
All posts

Databricks SQL Lead Lag Function

Martin DebusPosted on LinkedIn

The lead and lag window functions in Databricks SQL are strong when analyzing sequences.

Want to know how much time passed between two events, e.g. customer purchases? Use the lag function utilizing the customer-id and the purchasing date as the window and compute the difference with ease. No pivoting or joins required.

What is your favorite lead/lag use case?

https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/functions/lead

Image 1 of 2 for the post Databricks SQL Lead Lag FunctionImage 2 of 2 for the post Databricks SQL Lead Lag FunctionView on LinkedIn

Working on this in your platform?

SNOWGLOBE helps teams set up, grow and run Azure Databricks platforms.