Designed and developed an end-to-end Business Intelligence solution analyzing 50,000+ retail transactions across 4 years (2015β2018). The project involved writing advanced SQL queries for data extraction and building an interactive 3-page Power BI dashboard to uncover revenue drivers, customer retention patterns, and product performance insights.
Tools: SQL Server Β· Power BI Desktop Β· DAX Β· Power Query
Dataset: 50,000+ retail transactions | 4 years | 4 regions | 3 product categories
A retail company needed answers to these critical questions:
- Which regions and products drive the most revenue?
- Are customers returning or buying only once?
- Which year/quarter had the highest growth?
- How are customers segmented by value (High/Mid/Low)?
- What are the top-performing products and sub-categories?
| Metric | Value | Insight |
|---|---|---|
| π° Total Revenue | $2,261,536 | 4-year cumulative |
| π₯ Total Customers | 793 | Unique buyers |
| π¦ Total Products | 1,861 | Distinct SKUs |
| π Best Year | 2018 ($7.2M) | 20% YoY growth |
| π Top Region | West ($7.1M / 31%) | Highest revenue region |
| π Top Customer | Sean Miller ($25K) | Highest lifetime value |
| π Repeat Customers | 98.36% | Extremely high retention |
| π Best Category | Technology (36.59%) | Revenue leader |
| π± Best Sub-category | Phones | Highest sub-category sales |
| π₯ Top Product | Canon imageCLASS ($62K) | Revenue concentration |
Visuals:
- 3 KPI Cards β Total Revenue, Total Customers, Total Products
- Monthly Revenue Trend (Line Chart) β peaks in Nov/Dec (holiday season)
- Yearly Revenue Growth (Column Chart) β consistent YoY growth
- Revenue Trend 2015β2018 (Line Chart) β overall business trajectory
Key Insight: Revenue grew consistently from $4.8M (2015) β $7.2M (2018) β 50% growth in 4 years
Visuals:
- Customer Segmentation Donut β A (High Value) / B (Mid Value) / C (Low Value)
- Top 10 Customers Bar Chart β ranked by lifetime revenue
- Revenue by Region Bar Chart β West dominates
- Revenue by Category Pie Chart β Technology leads
Key Insight: 98.36% repeat customers β indicates extremely strong brand loyalty and customer retention
Visuals:
- Revenue by Category Treemap β Technology, Furniture, Office Supplies
- Top 5 Products Bar Chart β revenue concentration analysis
- Revenue by Sub-Category Bar Chart β all 17 sub-categories ranked
Key Insight: Top 5 products contribute significant revenue concentration β risk identified for business strategy
-- Total Revenue, Customers, Products
SELECT ROUND(SUM(sales),2) AS total_sales,
COUNT(DISTINCT customer_id) AS total_customer,
COUNT(DISTINCT product_id) AS total_products
FROM salesWITH monthly_sales AS (
SELECT FORMAT(order_date, 'yyyy-MM') AS month,
ROUND(SUM(sales),2) AS revenue
FROM sales
GROUP BY FORMAT(order_date, 'yyyy-MM')
)
SELECT month, revenue,
ROUND((revenue - LAG(revenue) OVER (ORDER BY month)) * 100.0
/ LAG(revenue) OVER (ORDER BY month), 2) AS growth_percent
FROM monthly_salesSELECT customer_id, total_revenue,
CASE
WHEN cumulative_percent <= 70 THEN 'A - High Value'
WHEN cumulative_percent <= 90 THEN 'B - Mid Value'
ELSE 'C - Low Value'
END AS customer_segment
FROM (
SELECT customer_id, total_revenue,
ROUND(SUM(total_revenue) OVER (ORDER BY total_revenue DESC
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) * 100.0
/ SUM(total_revenue) OVER (), 2) AS cumulative_percent
FROM (
SELECT customer_id, SUM(sales) AS total_revenue
FROM sales GROUP BY customer_id
) t
) aSELECT year_month, revenue, prev_year_revenue,
ROUND((revenue - prev_year_revenue) * 100.0
/ prev_year_revenue, 2) AS growth
FROM (
SELECT year_month, revenue,
LAG(revenue, 12) OVER (ORDER BY year_month) AS prev_year_revenue
FROM (
SELECT FORMAT(order_date, 'yyyy-MM') AS year_month,
SUM(sales) AS revenue
FROM sales
GROUP BY FORMAT(order_date, 'yyyy-MM')
) s
) t| Concept | Usage |
|---|---|
| Window Functions | LAG, DENSE_RANK, SUM OVER, ROWS BETWEEN |
| CTEs | Month-over-month growth calculations |
| Subqueries | Customer segmentation, revenue concentration |
| CROSS JOIN | Percentage calculations |
| Date Functions | FORMAT, DATEPART, DATENAME, DATEADD |
| Aggregations | SUM, COUNT DISTINCT, AVG, ROUND |
| Skill | Usage |
|---|---|
| Power Query | Data transformation, custom columns |
| DAX Measures | MoM Growth %, calculated KPIs |
| Data Modeling | Table relationships, cardinality |
| Interactive Slicers | Year and Region filters |
| Visualizations | Line, Bar, Column, Donut, Pie, Treemap, Cards |
Retail-Sales-Dashboard/
β
βββ π Retail_sales_dashboard.pbix # Power BI Dashboard
βββ πΎ business_insight_sql_analysis.sql # All SQL Queries
βββ π retail_sales_data.csv # Raw Dataset
β
βββ πΌοΈ sales_overview.png # Page 1 Screenshot
βββ πΌοΈ customer_analysis.png # Page 2 Screenshot
βββ πΌοΈ product_analysis.png # Page 3 Screenshot
β
βββ π README.md # Project Documentation
To explore SQL queries:
- Open
business_insight_sql_analysis.sqlin SQL Server Management Studio - Create database
storesales - Import
retail_sales_data.csv - Run queries one by one
To view Power BI Dashboard:
- Download
Retail_sales_dashboard.pbix - Open in Power BI Desktop (free)
- Update data source to your SQL Server
- Explore all 3 pages with interactive slicers
β
Identified West region as top revenue driver β
focus marketing budget here
β
98.36% repeat customers discovered β
loyalty program already working well
β
Technology category leads revenue β
increase inventory investment
β
Revenue grew 50% over 4 years β
business is on strong growth trajectory
β
Top 5 products = revenue concentration risk β
diversification strategy needed
β If you found this project helpful, please give it a star!
Built with β€οΈ using SQL Server & Power BI


