Skip to content

mayuresh0711/Supply-Chain-Sales-Analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Supply Chain Sales Analytics

End-to-End Analytics Engineering & Business Intelligence Project

An end-to-end Supply Chain Sales Analytics project demonstrating real-world analytics engineering, data warehousing, and BI reporting using PostgreSQL and Power BI.

This project follows industry-grade BI architecture: staged ingestion, dimensional modeling, partitioned fact tables, optimized reporting views, and dashboard-driven insights.


πŸš€ Project Highlights

  • Designed a scalable star-schema data warehouse
  • Built partitioned fact tables for large-scale analytics
  • Implemented staged ETL pipelines using pure SQL
  • Clearly separated warehouse logic from reporting logic
  • Optimized performance using indexes and materialized views
  • Delivered production-ready Power BI dashboards
  • Performed customer lifecycle, RFM, and ABC analysis

🎯 Business Objectives

  • Enable analytics-ready reporting for supply chain data
  • Analyze sales performance, delivery behavior, and customer retention
  • Identify high-value customers and high-impact products
  • Reduce dashboard load time using pre-aggregated views
  • Support business decision-making through KPI-driven insights

πŸ“¦ Dataset Overview

The dataset represents order-item–level supply chain transactions, including:

  • Orders and order items
  • Customer demographics and behavior
  • Products, categories, and departments
  • Shipping modes, delivery timelines, and fulfillment metrics
  • Sales, profit, and quantity measures

Raw data is ingested as text and progressively refined through typed staging, warehouse modeling, and reporting views.


πŸ—οΈ Architecture Overview

staging.dataco_raw        (raw ingestion – all text)
        ↓
staging.dataco_clean      (typed & cleaned staging)
        ↓
warehouse schema
β”œβ”€β”€ dim_date
β”œβ”€β”€ dim_customer
β”œβ”€β”€ dim_product
└── fact_order_items      (partitioned by order year)
        ↓
reports schema
β”œβ”€β”€ Reporting Views (per dashboard page)
└── Materialized Views (RFM, ABC)
        ↓
Power BI Dashboards

This layered architecture mirrors modern analytics engineering workflows used in production BI systems.


🧱 Data Model (Star Schema)

Fact Table

warehouse.fact_order_items

  • Grain: One row per order item
  • Partitioning: By order year
  • Measures: Sales, profit, quantity, shipping duration, delivery delay indicators

Dimension Tables

  • dim_date – Calendar attributes (year, month, week, weekday/weekend)
  • dim_customer – Customer demographics and behavioral attributes
  • dim_product – Product, category, and department hierarchy

This design enables high-performance joins and BI-friendly consumption.


πŸ”„ ETL & Data Processing Phases

Phase 1 β€” Raw Staging

  • Ingest raw CSV into staging.dataco_raw
  • All columns stored as TEXT
  • Initial data profiling and validation

Phase 2 β€” Cleaned Staging

  • Safe type casting (numeric, date, timestamp)
  • Parsing order and shipping timestamps
  • Stored in staging.dataco_clean

Phase 3 β€” Warehouse Modeling

  • Star schema creation
  • Surrogate keys for dimensions
  • Fact table partitioned by year

Phase 4 β€” Data Loading

  • Dimension population
  • Fact loading with surrogate key mapping
  • Referential integrity checks

Phase 5 β€” Performance Optimization

  • Foreign key and filter indexes
  • Composite indexes for BI queries
  • Materialized views for heavy aggregations

πŸ“Š Reporting & Analytics Layer

All dashboards consume data exclusively from the reports schema.

Reporting SQL Files

SQL File Dashboard Purpose
01_sales_dashboard.sql Sales Overview
02_geographical_dashboard.sql Geographical Analysis
03_product_customer_dashboard.sql Product & Customer Insights
04_delivery_behavior_dashboard.sql Delivery Behavior
05_customer_analytics.sql Customer Lifecycle & Retention
06_materialized_views.sql RFM & ABC Optimizations

Each SQL file has a clear purpose header, defines a single reporting contract, and is safe to re-run (DROP + CREATE pattern).


πŸ“ˆ Advanced Analytics Implemented

Customer Lifecycle & Retention

  • New vs Returning vs Churned customers
  • Customer lifetime behavior tracking
  • Retention and churn risk indicators

RFM Analysis (Materialized View)

  • Recency, Frequency, Monetary scoring
  • Customer segmentation:
    • Loyal Customers
    • Potential Loyalists
    • Needs Attention
    • At Risk / Lost

Product ABC Analysis

  • Revenue-based product classification:
    • A: High-value products
    • B: Medium-value products
    • C: Low-value products

Materialized views significantly reduce Power BI query load time.


πŸ“Š Power BI Dashboards

The Power BI report is built entirely on SQL reporting views.

Dashboard Pages

  • Sales Overview
  • Geographical Analysis
  • Product & Customer Insights
  • Delivery Behavior
  • Customer Lifecycle & Retention

πŸ–ΌοΈ Dashboard Previews

Sales Overview Dashboard

Sales Overview

Geographical Analysis Dashboard

Geographical Analysis

Product & Customer Analysis Dashboard

Product & Customer Analysis

Delivery Behavior Dashboard

Delivery Behavior

Customer Lifecycle Dashboard

Customer Lifecycle


πŸ“ Repository Structure

Supply-Chain-Sales-Analytics/
β”‚
β”œβ”€β”€ powerbi/
β”‚   └── Supply_Chain_Sales_Analytics.pbix
β”‚
β”œβ”€β”€ screenshots/
β”‚   └── dashboard previews (.png)
β”‚
β”œβ”€β”€ sql/
β”‚   β”œβ”€β”€ staging/
β”‚   β”‚   └── 01_staging_raw_and_clean.sql
β”‚   β”‚
β”‚   β”œβ”€β”€ warehouse/
β”‚   β”‚   β”œβ”€β”€ 01_dimensions.sql
β”‚   β”‚   β”œβ”€β”€ 02_fact_order_items_partitioned.sql
β”‚   β”‚   └── 03_fact_order_items_indexes.sql
β”‚   β”‚
β”‚   └── reports/
β”‚       β”œβ”€β”€ 01_sales_dashboard.sql
β”‚       β”œβ”€β”€ 02_geographical_dashboard.sql
β”‚       β”œβ”€β”€ 03_product_customer_dashboard.sql
β”‚       β”œβ”€β”€ 04_delivery_behavior_dashboard.sql
β”‚       β”œβ”€β”€ 05_customer_analytics.sql
β”‚       └── 06_materialized_views.sql
β”‚
β”œβ”€β”€ .gitignore
└── README.md

πŸ› οΈ Tools & Technologies

  • PostgreSQL
  • SQL (Analytics Engineering)
  • Power BI
  • Data Warehousing
  • Star Schema Modeling
  • Table Partitioning & Indexing
  • Git & GitHub

πŸ‘€ Author

Mayuresh Ahire Data Analyst | Analytics Engineering | Business Intelligence

About

End-to-end Supply Chain Sales Analytics using PostgreSQL and Power BI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors