Compare 30, 60 and 90 Day Revenue per Customer Across Acquisition Cohorts

Last updated: November 29, 2026

Quick Overview

Group new customers by the month of their first order and compute average cumulative revenue per customer at 30, 60 and 90 days after that first order, only for customers whose horizon is fully observed.

Amazon
Data Manipulation (SQL/Python)
Data Scientist
Amazon
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Hard

0

0

0 solved


Group new customers by the month of their first order and compute average cumulative revenue per customer at 30, 60 and 90 days after that first order, only for customers whose horizon is fully observed.

A lifetime value question in the style of Amazon marketing and retail finance analytics, used to compare acquisition months and channels on an equal footing. The interviewer checks per-horizon eligibility, revenue windows anchored on each customer's own first order, and an honest denominator.

What the Interviewer Expects
  • Anchor every customer's windows on their own first order timestamp
  • Use conditional aggregation for the 30, 60 and 90 day windows
  • Apply eligibility per horizon so young cohorts are not penalized
  • Include zero-revenue customers beyond the first order in the denominator
  • Explain whether day 0 revenue is included
Key Topics to Cover
customer lifetime value
cohorts
conditional aggregation
censoring
window anchoring
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you split this by acquisition channel such as paid search or Prime Day?
  • How would you add contribution margin instead of revenue?
  • How would you project 365-day value for cohorts that are too young?
  • Why might the average be misleading and what would you show alongside it?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Table orders(order_id, customer_id, order_ts, order_total, status). Use shipped orders. Revenue at horizon H is the sum of all orders with order_ts < first_order_ts + H days, including the first o...

Approach
  1. firsts: first order time and cohort month per customer, using MIN as a window so I can keep every order row with its anchor.
  2. Per customer, conditional sums give cumulative revenue at each ho...

Submit Your Answer
Markdown supported