FIRST_VALUE & LAST_VALUE: First Orders, Cohort Labels and the Latest Row
This lesson is part of the course
In this lesson
You write each customer's first order date next to every order, turn it into a cohort label, fetch the amount of the first order and mark the latest order of each customer – and learn why LAST_VALUE so often returns the current row.
Buy the course once for $9.99 to unlock every lesson and lab, the final exam and the certificate – lifetime access, no subscription.
Lessons in this course
- PARTITION BY vs GROUP BY: Group Totals Next to Every Row Locked
- Running Totals: Cumulative Sums per Customer, Ties & the Running Share Locked
- ROW_NUMBER, RANK & DENSE_RANK per Group: Ties and Top-n Locked
- LAG & LEAD: Previous and Next Order, Gaps and Changes Locked
- Moving Averages & Rolling Windows: Date Ranges vs Row Counts Locked
- NTILE & PERCENT_RANK: Quartiles, Percentiles and Halves per Group Locked
- FIRST_VALUE & LAST_VALUE: First Orders, Cohort Labels and the Latest Row Locked
- Capstone: Sessionisation – Gaps, New-Session Flags and Session Numbers Locked