← Back to Portfolio

Project 2 · E-commerce Segmentation

E-commerce Sales Performance & RFM Customer Segmentation

This project builds a Python + SQLite pipeline that generates RFM scoring outputs and Tableau-ready files for segmentation and promo performance analysis.

PythonSQLiteSQL CTEsTableauRFM

Business Problem & Objectives

  • Identify high-value and low-engagement customer segments with a reproducible RFM process.
  • Quantify promo-code order behavior from the same synthetic sales dataset.
  • Export clean files for dashboarding and relationship-based Tableau modeling.

Dataset & Data Products

  • Raw dataset: synthetic_ecommerce_sales_2025.csv (5,000 rows, 8 columns, 2025-01-01 to 2025-12-31).
  • Unique customers in provided data: 797.
  • Primary outputs: output/promo_roi.csv, output/rfm_segments.csv, data/rfm_scores.csv, data/full_ecom.csv.

Methodology

  • Load CSV into SQLite table ecom using Python and SQLAlchemy.
  • Create views for order-level and customer-level analysis.
  • Build RFM scores with SQL CTEs and NTILE(5) scoring logic.
  • Export segment and promo summaries, then map to Tableau fields.

Key Findings (Current Outputs)

  • Promo summary includes four active codes (SAVE10, SUMMER20, FLASH30, WELCOME15).
  • Highest 5-5-5 segment count in current output is 10 customers.
  • Promo order average and non-promo order average are nearly equal in this dataset snapshot.
  • RFM outputs are ready for heatmap views and segment drilldowns in Tableau.

Visualization Preview

Illustrative RFM heatmap layout (based on r_score × f_score) R score F score This is an illustrative graphic built from documented project fields; no Tableau screenshot file is included in this repository.
Illustrative heatmap composition aligned to the SQL/Tableau field design in TABLEAU_SETUP.md.
Promo ROI (from output/promo_roi.csv) SAVE10 SUMMER20 FLASH30 WELCOME15 $163,591.65
Promo revenue totals from exported SQL query results.