GitHunt
AR

ArpitaRandive/Customer-Churn-Revenue-Analysis-SQL-Project-

End-to-end SQL project analyzing customer churn and revenue using transactional sales data. The project applies SQL joins, aggregations, CTEs, and window functions to classify customers into Active, Churned, and Never Converted segments, with results visualized in Power BI.

๐Ÿ“Š Customer Churn & Revenue Analysis โ€” SQL Project

An end-to-end SQL analytics project analyzing customer churn, revenue trends, and lifetime value from transactional sales data โ€” visualized in Power BI.


๐Ÿ“Œ Project Overview

This project simulates a real-world analytics workflow where SQL is the primary tool for data extraction, transformation, and analysis. It covers revenue performance, customer lifecycle segmentation, and churn identification โ€” all built on a normalized relational database.


๐ŸŽฏ Objectives

  • ๐Ÿ“ˆ Analyze overall and monthly revenue performance
  • ๐Ÿ›๏ธ Understand customer purchasing behavior
  • ๐Ÿ”„ Classify customers into lifecycle segments
  • ๐Ÿ’Ž Identify high-value customers and top-performing products
  • ๐Ÿ’ฐ Calculate Average Order Value & Customer Lifetime Value (LTV)
  • ๐Ÿ“Š Prepare SQL outputs for BI visualization

๐Ÿ—ƒ๏ธ Data Model

A normalized relational schema ensuring data integrity and analytical flexibility.

Table Description
Customers Customer details and signup information
Products Product names, categories, and pricing
Orders Order-level data including dates and status
Order Items Line-item details โ€” quantity and item price

Relationships:

  • One customer โ†’ Many orders
  • One order โ†’ Many products
  • One product โ†’ Many orders

๐Ÿ’น Revenue Analysis

Key analyses performed:

  • โœ… Total revenue from all completed transactions
  • โœ… Monthly revenue trends (growth, decline, seasonality)
  • โœ… Month-over-month revenue change
  • โœ… Revenue by customer (top contributors)
  • โœ… Revenue by product and category

๐Ÿ‘ฅ Customer Behavior Analysis

Examining order frequency, recency, and total spending to identify:

  • One-time vs repeat customers
  • High-frequency purchasers
  • Top revenue-contributing customers

๐Ÿ”„ Customer Lifecycle Segmentation

Customers classified into 3 lifecycle segments:

Segment Definition
โœ… Active Completed order within recent time window
โš ๏ธ Churned Last purchase beyond inactivity threshold
โŒ Never Converted Signed up but never placed a completed order

Classification is based on last completed order date โ€” a standard industry approach for churn analysis.


๐Ÿ’Ž Customer Lifetime Value (LTV)

Total revenue generated per customer across all completed purchases.

Business use cases:

  • Identify high-value customers
  • Analyze revenue concentration
  • Support retention and targeting decisions

๐Ÿ“Š Power BI Dashboard

All business logic lives in SQL. Results are visualized in Power BI with:

  • ๐Ÿ“Œ KPI summaries (customer counts, churn rate, revenue)
  • ๐Ÿ“ˆ Monthly revenue trend analysis
  • ๐Ÿ† Revenue breakdown by customer and product
  • ๐Ÿ‘ฅ Customer count by lifecycle status

Customers with no transactions are excluded from revenue visuals but included in customer count metrics for accurate business representation.


๐Ÿ› ๏ธ SQL Techniques Used

  • JOIN โ€” linking customers, orders, products
  • CTE (Common Table Expressions) โ€” modular query design
  • Window Functions โ€” ranking, running totals, lag/lead
  • Aggregations โ€” revenue, frequency, LTV calculations
  • CASE statements โ€” lifecycle classification logic

๐Ÿš€ How to Use

  1. Execute SQL scripts to create tables and populate data
  2. Run analytical queries from the provided SQL files
  3. Review query outputs or load into Power BI for visualization
  4. Explore insights on revenue, churn, and customer behavior

๐Ÿ’ก Key Learnings

  • SQL can power end-to-end analytical workflows without additional tools
  • Distinguishing transactional vs non-transactional customers is critical
  • Churn logic can be implemented using simple, explainable rules
  • Relational data modeling enables flexible, scalable analysis
  • SQL + Power BI is a powerful combo for business intelligence

๐Ÿ”ฎ Future Enhancements

  • Add cohort-based churn tracking
  • Incorporate RFM (Recency, Frequency, Monetary) scoring
  • Build stored procedures for automated reporting
  • Connect live database to Power BI for real-time dashboards

Made with โค๏ธ by Arpita Randive