Skip to main content
SQL • LESSON 185

Customer Lifetime Value

How can we calculate total completed spending for every customer?

Advanced3 Minutes1980 XP
🤔 THE QUESTION

How can we calculate total completed spending for every customer?

💡 WHAT IS IT?

Filtering completed orders and aggregating by customer_id measures Customer Lifetime Value (CLV).

🎯 WHAT IS IT USED FOR?

CLV reporting, marketing ROI attribution, customer cohort valuation.

💻 EXAMPLE
SELECT
customer_id,
SUM(amount) AS lifetime_value
FROM orders
WHERE status = 'Completed'
GROUP BY customer_id;

🎯 Mission Objectives

Practice typing production-grade SQL code for Customer Lifetime Value.

  • Customer Lifetime Value
  • Completed status filter
  • Revenue summation
  • Cohort metrics