Skip to content

stevenkaranja/churn_and_revenue_forecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Š Telco Customer Churn Analysis And Revenue Forecasting

image

๐Ÿ“ Project Overview

This project analyzes customer churn in a telecommunications company to identify key drivers of churn, forecast future revenue impact, and develop data-driven retention strategies.
It combines SQL, Python, and Power BI for a full data pipeline โ€” from raw data extraction to advanced analytics and executive-level visualization.


๐ŸŽฏ Objectives

  • Understand why customers churn and identify at-risk segments.
  • Build predictive and financial models to estimate churn and its revenue impact.
  • Develop actionable strategies for retention and revenue optimization.
  • Present insights in an interactive Power BI dashboard for business leaders.

๐Ÿงฐ Tech Stack

Tool Purpose
Python (Pandas, NumPy, Scikit-Learn) Data cleaning, feature engineering, churn modeling
SQL (PostgreSQL / MySQL) Data extraction, aggregation, and KPI computation
Power BI Executive dashboards, churn prediction visualization, forecasting
Excel Exploratory data review and validation
GitHub Project versioning and portfolio publication

๐Ÿงฉ Data Pipeline

Raw Telco Data โ†’ SQL Cleaning โ†’ Python Modeling โ†’ Power BI Visualization โ†’ Strategic Insights

  1. Data Cleaning & Transformation

    • Removed duplicates and nulls from TotalCharges.
    • Standardized categorical fields and encoded binary attributes.
    • Calculated new metrics such as AvgMonthlyRevenue, CLV, and ChurnRate.
  2. SQL Analysis

    • Aggregated churn by contract, payment method, and tenure.
    • Segmented customers by revenue and churn behavior.
    • Calculated revenue retention under various churn scenarios.
  3. Predictive Modeling (Python)

    • Built a logistic regression model to predict churn probability.
    • Evaluated using accuracy, precision, recall, and ROC-AUC metrics.
    • Exported predictions for visualization in Power BI.
  4. Power BI Reporting

    • Designed a 5-page interactive dashboard with executive KPIs, churn analysis, and revenue forecasting.

๐Ÿ“Š Power BI Dashboard Overview

The Power BI report consists of 5 pages, each designed for specific business decisions:

1. ๐Ÿข Executive Overview

High-level company performance snapshot with KPIs:

  • Total Customers, Active vs Churned
  • Churn Rate (%)
  • Average Tenure
  • Monthly & Total Revenue

2. ๐Ÿ” Churn Predictions

Machine learning-powered churn probability visualization:

  • Filters by gender, contract, and payment type
  • Top churn drivers identified using feature importance
  • At-risk customer segments highlighted

3. ๐Ÿ“ˆ Revenue Forecast

Predicts future revenue based on historical trends and churn rate.

  • Time-series forecasting using Power BIโ€™s analytics pane
  • Comparison of baseline vs retention-improved revenue scenarios

4. ๐Ÿ’ฐ Customer Lifetime Value (CLV)

Segments customers by their lifetime value contribution:

  • CLV tiers (High / Medium / Low)
  • Relationship between CLV, tenure, and churn probability
  • Focus on high-value churners for retention targeting

5. ๐Ÿงฎ Revenue Strategy Simulation

Interactive โ€œwhat-ifโ€ analysis to simulate revenue impact of:

  • Retention improvements
  • Contract upgrades
  • Customer loyalty programs

๐Ÿ” Key Insights & Findings

  • Overall churn rate: 26.5% of customers have churned.
  • Contract type: Month-to-month customers are 2.4ร— more likely to churn.
  • Payment method: Electronic check users churn 30% faster than other groups.
  • Tenure: Customers with <12 months tenure represent 60% of all churns.
  • CLV impact: High-value customers contribute over 60% of total revenue, making them critical for retention.
  • Forecast insight: A 5% improvement in retention leads to ~12% increase in annual revenue.

These insights guide retention strategies focused on contract conversion, early engagement, and loyalty incentives.


๐Ÿ“ˆ Results Summary

Metric Value Description
Churn Rate 26.5% Percentage of customers lost
Retention Improvement Potential +5% From targeted contract & payment fixes
Forecasted Revenue Uplift +12% Annual projection with improved retention
Model Accuracy 83% Logistic regression churn model
CLV Uplift +18% From focus on high-value customers

๐Ÿงฉ Project Structure

Telco-Churn-Analysis/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/ WA_Fn-UseC_-Telco-Customer-Churn # Original CSV dataset
โ”‚   โ”œโ”€โ”€ processed/cleaned_customers           # Cleaned data for modeling and Power BI
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 01_data_import.ipynb
โ”‚   โ”œโ”€โ”€ 02_feature_engineering.ipynb
โ”‚   โ”œโ”€โ”€ 03_chun_modelling.ipynb
โ”‚   โ”œโ”€โ”€ 04_revenue_forecast.ipynb
โ”‚
โ”œโ”€โ”€ sql/
โ”‚   โ”œโ”€โ”€ churn_project.sql   # SQL queries for churn, CLV, revenue segmentation
โ”‚
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ db_config.py         # Database configuration
โ”‚   โ”œโ”€โ”€ db_connection.py     # Connection handler
โ”‚   โ”œโ”€โ”€ generate_revenue.py   # Preprocessing and feature engineering scripts
โ”‚
โ”œโ”€โ”€ powerbi/
โ”‚   โ”œโ”€โ”€ Telco_Churn_Analysis.pbix   # Power BI Dashboard file
โ”‚
โ”œโ”€โ”€ reports/
โ”‚   โ”œโ”€โ”€ Telco_Churn_Analysis_Report.pdf
โ”‚
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ requirements.txt

๐Ÿš€ How to Run

  1. Clone the repository
git clone https://github.com/yourusername/Telco-Churn-Analysis.git
  1. Navigate to the folder
cd Telco-Churn-Analysis
  1. Install dependencies
pip install -r requirements.txt
  1. Open the notebooks in Jupyter or VSCode jupyter notebook

๐Ÿง  STEP 2: Replace Before Commit

Before you commit:

  1. Replace
    • https://app.powerbi.com/your_dashboard_link โ†’ your published Power BI report link
    • yourusername, your_email@example.com, and LinkedIn link.
  2. Keep the triple backticks (```) around code blocks โ€” GitHub formats them automatically.
  3. Commit using:
    git add README.md
    git commit -m "Add project documentation"
    git push
    

โญ Project Highlights

โœ… End-to-end data analysis: from SQL โ†’ Python โ†’ Power BI

โœ… Predictive churn modeling integrated into visualization

โœ… Strategic simulation of retention impact

โœ… Ready for presentation to executives or recruiters

โ€œData without interpretation is just noise; turning churn analytics into action is what drives value.โ€

๐Ÿ“˜ References

Kaggle: Telco Customer Churn Dataset

Power BI Documentation โ€“ Forecasting and Analytics

Scikit-Learn Logistic Regression Reference

๐Ÿ‘ค Author

Stephen Karanja

Data Analyst | BI Developer | Automation Specialist

๐Ÿ“ง muhurakaranja7@gmail.com

๐Ÿ”— LinkedIn Profile

๐ŸŒ Portfolio / Website

๐Ÿชช License

This project is licensed under the MIT License โ€“ see the LICENSE file for details.


About

A full data analytics case study that identifies why telecom customers churn, predicts future churn with machine learning, and visualizes actionable business insights in Power BI dashboards.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages