Practice / window functions

Day Over Day

medium

A growth team tracks daily sign-ups and wants the day-over-day change.

daily

Your task: return day, signups, and a delta — the change in signups versus the previous day, ordered by day. Keep the first day, whose delta is null (there is no previous day to compare against).

Assign your answer DataFrame to result. Row order doesn't matter.

dailyinput DataFrame

Schema
columntype
daystring
signupslong
Sample rows
daysignups
2026-06-0110
2026-06-0214
2026-06-039
Expected output shape
daysignupsdelta· 3 rows
Hint

w = Window.orderBy("day"), then delta = F.col("signups") - F.lag("signups", 1).over(w). The first row has no previous day, so lag is null and the subtraction is null — keep that row.

Lesson refresher

This problem builds on Window Functions (~9 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.