Master business date calculations: cohort retention matrices, Month-over-Month (MoM) revenue growth, date truncation, and rolling intervals.
Key Takeaways at a Glance:
- •DATE_TRUNC('month', date) truncates timestamps to the beginning of the period, enabling clean grouped cohort aggregation.
- •Month-over-Month (MoM) growth compares current month metrics to the previous month using LAG(revenue, 1) OVER (ORDER BY month).
- •Rolling 7-day windows use 'ROWS BETWEEN 6 PRECEDING AND CURRENT ROW' to smooth out day-of-week fluctuations.
- •Day-N cohort retention measures what percentage of users who signed up on Day 0 return on Day N.