This repository continues from the foundational SQL Data Warehouse project and introduces advanced analytical modules designed to extract deeper business insights from the existing data warehouse. This phase focuses on time-based trends, cumulative KPIs, segmentation logic, and comprehensive reporting views for both customers and products.
Tracks sales trends, growth, and seasonality using multiple time-based aggregation techniques:
- Year-Month aggregation
DATETRUNC()
for monthly groupingsFORMAT()
for custom date formatting- Calculates total sales, total customers, and total quantity by period
Calculates cumulative business performance over time to visualize long-term trends:
- Running totals (
SUM() OVER
) - Moving averages (
AVG() OVER
) - Yearly aggregation for sales and pricing trends
Performs detailed benchmarking and year-over-year performance comparison:
- Product sales vs. average sales (above/below average logic)
- Year-over-year (YoY) growth using
LAG()
- Categorizes performance change as 'Increase', 'Decrease', or 'No Change'
Segments data into meaningful customer and product groups:
- Product Segmentation: Based on product cost into 4 brackets
- Customer Segmentation: VIP, Regular, and New customers based on spending and customer lifespan
Evaluates category contribution to overall sales:
- Calculates percentage share of each product category
- Highlights dominant revenue-generating segments
Generates a consolidated customer report view with detailed metrics:
- Customer demographics (age groups)
- Purchase behavior (total orders, sales, quantity)
- Customer segmentation logic (VIP, Regular, New)
- Key KPIs: recency, lifespan, average order value, and average monthly spend
Generates a comprehensive product-level report view:
- Product details with category and subcategory
- Performance segmentation: High-Performer, Mid-Range, Low-Performer
- KPIs: total sales, orders, customers, average selling price, recency, AOR, and monthly revenue
- Advanced Time-Series Analysis
- Cumulative Metrics & Moving Averages
- Year-over-Year Performance Benchmarking
- Customer and Product Segmentation Logic
- Part-to-Whole Contribution Analysis
- Business-Oriented Reporting Views
- Microsoft SQL Server
- Management Tool (SQL Server Management Studio — SSMS)
- Phase 1 Database Setup Required (Fact & Dimension tables)