Skip to content

Tanu272004/Retail-Analytics-Customer-Purchase-Behavior-Market-Basket-Insights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸͺ Retail Analytics – Customer Purchase Behavior & Market Basket Insights

## πŸ“˜ Project Overview
This project explores **retail point-of-sale (POS) data** to uncover customer purchase behaviors, top-selling products, and cross-selling opportunities.  
Using **Python (for synthetic data generation)**, **Google BigQuery (for SQL analysis)**, and **Power BI (for visualization)** β€” this end-to-end analytics workflow simulates a real enterprise retail analytics pipeline.

---

## 🎯 Objectives
- Identify **top-selling products** and seasonal trends  
- Perform **Market Basket Analysis** to find co-purchased items  
- Conduct **RFM-based Customer Segmentation** (Recency, Frequency, Monetary)  
- Analyze **discount impacts** on revenue  
- Visualize results with an **interactive Power BI dashboard**

---

## 🧠 Key Insights
- πŸ’° **Total Revenue:** $5.47M (YoY +12%)  
- πŸ‘₯ **Active Customers:** 3,862 (Last 90 Days)  
- πŸ’³ **Avg Order Value:** $141.7  
- πŸ“‰ **Discount Impact:** –$182,540 on total profit  
- πŸ” **Top Basket Pair:** β€œCoffee β†’ Sugar” (67% co-purchase rate)

---

## πŸ› οΈ Tech Stack
| Tool | Purpose |
|------|----------|
| **Python (Faker, Pandas)** | Generate synthetic retail dataset |
| **Google BigQuery** | Perform SQL-based data analysis |
| **Power BI** | Build interactive dashboards |
| **DAX** | Advanced calculations for KPIs |
| **GitHub** | Project documentation & version control |

---

## 🧩 Project Workflow

### **1️⃣ Data Generation**
Synthetic dataset created using `Faker` library:  
- Fields: CustomerID, ProductName, Quantity, Price, Discount, PurchaseDate, Country  
- 5,000+ records saved as `retail_pos_sales.csv`

```python
fake.date_between(start_date='-1y', end_date='today')
Data Storage & Querying (BigQuery)

Dataset imported to:
optimum-courier-472707-k9.retail_analytics.pos_sales

Sample SQL Queries:

Top-selling products by revenue

RFM analysis for segmentation

Market basket joins for co-purchased products

Discount vs revenue correlation

3️⃣ Data Visualization (Power BI)

3 Interactive Pages:

Executive Overview: KPIs, monthly trends, channel analysis

Customer Insights: RFM segmentation, demographic distribution

Product Insights: Market basket, discounts, and category sales

πŸ“Š Dashboard Pages
1️⃣ Executive Overview

Total Revenue, Active Customers, Avg Order Value

Monthly Revenue & Units Sold

Channel Split (Online / In-Store)

2️⃣ Customer Insights

RFM Segmentation (VIP, Loyal, At Risk, Lost)

Recency vs Frequency Scatter Plot

Gender & Age Distribution

3️⃣ Product Insights

Top-Selling Products

Market Basket Analysis (Product X β†’ Y)

Waterfall Chart (Discount Impact on Revenue)

πŸ“ˆ Example KPIs (Power BI)
KPI	DAX Formula
Active Customers	CALCULATE(DISTINCTCOUNT('pos_sales'[CustomerID]), FILTER('pos_sales', DATEDIFF('pos_sales'[PurchaseDate], TODAY(), DAY) <= 60))
Discount Amount	SUMX('pos_sales', 'pos_sales'[Price] * 'pos_sales'[Quantity] * 'pos_sales'[Discount] / 100)
Avg Order Value	DIVIDE(SUM('pos_sales'[TotalAmount]), COUNT('pos_sales'[TransactionID]))
πŸš€ Business Impact

Identified core customer segments driving 70% of revenue

Optimized discount policies improving profit margin by 8%

Discovered cross-selling opportunities for bundled offers

Improved customer retention strategy using RFM insights

🧩 Future Enhancements

Integrate real CRM or POS APIs

Predict churn likelihood using ML models

Deploy dashboard to Power BI Service for real-time refresh

Add inventory optimization and profit forecasting

πŸ“‚ Folder Structure
Retail_Analytics_Project/
β”‚
β”œβ”€β”€ data/
β”‚   └── retail_pos_sales.csv
β”‚
β”œβ”€β”€ scripts/
β”‚   └── generate_retail_data.py
β”‚
β”œβ”€β”€ powerbi/
β”‚   └── retail_analytics_dashboard.pbix
β”‚
β”œβ”€β”€ README.md
└── requirements.txt

Author: Tanmay Sharma
Role: Data Analyst
LinkedIn: https://www.linkedin.com/in/tanmay-sharma-800599373/
Git hub: https://github.com/Tanu272004/Retail-Analytics-Customer-Purchase-Behavior-Market-Basket-Insights.git  

Releases

No releases published

Packages

 
 
 

Contributors

Languages