Tanu272004/Retail-Analytics-Customer-Purchase-Behavior-Market-Basket-Insights
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Β | Β | |||
Β | Β | |||
Β | Β | |||
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