Skip to content

Latest commit

Β 

History

101 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

adventure-works-analytics (SQL Server + Power BI)

🌟 Overview

This project is an end-to-end Business Intelligence solution built on the Microsoft Adventure Works 2022 transactional database.

The objective of the project is to transform raw enterprise transactional data into analytical datasets and interactive dashboards focused on:

  • Product profitability analysis
  • Sales channel performance
  • Customer segmentation (B2B & B2C)
  • RFM behavioral modeling
  • Pareto revenue concentration analysis
  • Firmographic and demographic profiling
  • Time-series revenue analysis

The analytical layer was developed using advanced T-SQL in Microsoft SQL Server, where multiple SQL views were designed to support scalable business reporting and multidimensional analysis.

The solution was later integrated into Power BI to build a multi-page interactive dashboard environment optimized for business exploration, KPI tracking, customer analytics, and profitability evaluation.

Technical Focus

This project emphasizes:

  • Advanced SQL analytical modeling
  • Window functions (LAG, NTILE, ROW_NUMBER)
  • Historical cost matching using OUTER APPLY
  • Customer-level aggregation strategies
  • RFM segmentation models
  • Pareto analysis
  • Time-series calculations (MoM & YoY)
  • Dimensional analytical design for Power BI
  • Interactive dashboard development

Technologies Used

  • Microsoft SQL Server
  • T-SQL
  • Power BI
  • DAX

πŸš€ Power BI Dashboard

SalesDashboard.pbix

πŸ’‘ Dataset

This project uses the AdventureWorks2022 sample database from Microsoft, a simulated enterprise transactional dataset designed for business intelligence, sales analytics, and enterprise reporting scenarios.

The analytical solution integrates transactional, product, customer, geographic, demographic, and firmographic information to support multidimensional business analysis across both B2B and B2C environments.

Main Data Domains

The project combines data from multiple business areas, including:

  • Sales
  • Customers
  • Products
  • Production Costs
  • Stores
  • Customer Demographics
  • Customer Firmographics
  • Geographic Information

Core Tables Used

Sales

  • Sales.SalesOrderHeader
  • Sales.SalesOrderDetail
  • Sales.Customer

Products & Production

  • Production.Product
  • Production.ProductSubcategory
  • Production.ProductCategory
  • Production.ProductCostHistory

Customer & Demographics

  • Person.Person
  • Sales.Store
  • Sales.vPersonDemographics
  • Sales.vStoreWithDemographics
  • Sales.vStoreWithAddresses

Geography & Addresses

  • Person.Address
  • Person.BusinessEntityAddress
  • Person.vStateProvinceCountryRegion

Dataset Scope

The analytical model was designed to support seven major business intelligence areas:

  1. Product Profitability & Cost Analysis
  2. Sales Channel Analysis (Online vs Offline)
  3. Customer B2B Segmentation & RFM
  4. Customer B2C Segmentation & RFM
  5. Customer B2B Firmographics & Value Profitability
  6. Customer B2C Demographics & Value Profitability
  7. Time Series Analysis

The project includes both transactional-level analysis and aggregated analytical datasets optimized for dashboard performance and interactive business exploration.


Analytical Dataset Architecture

The analytical layer was developed through multiple SQL views designed specifically for Power BI integration.

These views support:

  • Product-level profitability analysis
  • Historical production cost matching
  • Customer segmentation models
  • Revenue concentration analysis
  • Geographic and demographic enrichment
  • Customer profitability evaluation
  • Time-series growth analysis

Data Modeling Approach

The project follows an analytical modeling approach focused on dimensional consistency, aggregation control, and reporting scalability.

Key Modeling Practices

  • Aggregated analytical datasets
  • Historical cost matching using OUTER APPLY
  • Customer-level enrichment
  • Time-series normalization
  • RFM segmentation models
  • Pareto revenue distribution analysis
  • Address prioritization using ROW_NUMBER()
  • Window-function-based analytical calculations
  • Separation of B2B and B2C analytical populations
  • Avoidance of duplicated transactional granularity

Analytical SQL Features Used

  • CTEs
  • LAG()
  • NTILE()
  • ROW_NUMBER()
  • OUTER APPLY
  • CASE
  • COALESCE
  • NULLIF
  • DATEFROMPARTS
  • Windowed aggregations with SUM() OVER

Project Workflow

  1. Raw transactional extraction from AdventureWorks2022
  2. SQL-based analytical transformations
  3. Historical cost matching and customer enrichment
  4. Aggregated analytical dataset creation
  5. Power BI data modeling and DAX measures
  6. Dashboard development and business analysis

Key SQL Concepts Used

  • Common Table Expressions (CTEs)
  • Window Functions
  • OUTER APPLY
  • Historical Cost Matching
  • RFM Segmentation Logic
  • Pareto Analysis
  • Time-Series Aggregation
  • Conditional Classification with CASE
  • Customer-Level Data Enrichment
  • Duplicate Prevention Strategies
  • Data Normalization
  • Geographic & Demographic Enrichment

πŸ“ Power BI Integration

The analytical datasets developed in SQL Server were integrated into Power BI to create an interactive business intelligence solution focused on profitability analysis, customer segmentation, channel performance, and time-series analytics.

The Power BI layer was designed to support:

  • Dynamic filtering
  • Drill-down exploration
  • KPI monitoring
  • Cross-visual interaction
  • Geographic visualization
  • Comparative analytical reporting

Data Modeling Highlights

  • Aggregated SQL analytical views
  • Customer-level and product-level modeling
  • Historical cost integration
  • Independent B2B and B2C segmentation models
  • Pareto analytical structures
  • Monthly time-series normalization
  • Prevention of many-to-many relationship conflicts

DAX Features

Main DAX implementations include:

  • Revenue calculations
  • Profitability metrics
  • Average Order Value (AOV)
  • MoM Growth %
  • YoY Growth %
  • Dynamic KPI calculations
  • Filter-responsive aggregations

πŸ“Š Dashboard Pages

Analyzes product-level profitability by combining revenue, historical costs, margins, pricing behavior, and product hierarchy analysis.


Compares Online and Offline customer purchasing behavior through revenue, orders, customer participation, and Average Order Value analysis.


Implements a B2B RFM segmentation model combined with Pareto analysis to evaluate customer value concentration and purchasing behavior.


Implements a B2C RFM segmentation model focused on customer loyalty, behavioral segmentation, and revenue concentration analysis.


Combines firmographic attributes, geographic information, business size, and transactional performance for B2B customer analysis.


Combines demographic attributes, customer profitability metrics, and geographic analysis for B2C customer profiling.


Analyzes monthly revenue evolution, MoM growth, YoY growth, and long-term business performance trends.


Dashboards Preview

Product Profitability Dashboard
Product Profitability & Cost Analysis


Sales Channel Dashboard
Sales Channel Analysis (Online vs Offline)


B2B RFM Dashboard
Customer B2B Segmentation & RFM


B2C RFM Dashboard
Customer B2C Segmentation & RFM


B2B Firmographics Dashboard
Customer B2B Firmographics & Value Profitability


B2C Demographics Dashboard
Customer B2C Demographics & Value Profitability


Time Series Dashboard
Time Series Analysis


Extended Documentation

imagen SQL Documentation

Detailed SQL implementations and technical breakdowns:

  • Product Profitability & Cost Analysis
  • Sales Channel Analysis
  • B2B & B2C RFM Models
  • Pareto Revenue Analysis
  • Firmographic & Demographic Modeling
  • Time Series Analysis

View SQL Documentation


Power BI Documentation

Detailed dashboard explanations, DAX logic, and data modeling structure.

View Power BI Documentation


imagen Business Insights & Case Study

Extended business insights, analytical interpretations, and strategic findings are documented separately in the project case study.

View Business Insights

View Full Case Study


✨ Conclusion

This project demonstrates the complete development of an end-to-end business intelligence solution using SQL Server and Power BI over the AdventureWorks2022 transactional database.

The analytical workflow combines:

Advanced T-SQL data modeling Customer behavioral segmentation Historical profitability analysis Time-series revenue analytics Geographic and demographic enrichment Interactive business intelligence dashboards

The SQL layer was designed to transform transactional data into analytical datasets optimized for reporting and decision-making, while Power BI was used to create interactive dashboards focused on operational visibility and business performance evaluation.

The project covers multiple analytical domains, including:

Product profitability Sales channel performance B2B and B2C customer segmentation RFM behavioral modeling Pareto revenue concentration analysis Demographic and firmographic profiling Revenue trend and seasonality analysis

Several advanced SQL concepts were applied throughout the implementation, including:

CTE-based modular transformations Window functions Historical cost resolution Customer-level aggregation Pareto cumulative analysis Time-series calculations Data enrichment and normalization

From a business perspective, the solution enables:

Identification of high-value customers and products Detection of revenue concentration patterns Analysis of customer purchasing behavior Evaluation of geographic and demographic business performance Monitoring of profitability and growth trends Support for strategic and operational decision-making

Overall, the project reflects a complete analytical pipeline that integrates data engineering, business intelligence, and data visualization practices into a unified enterprise analytics solution.


πŸ—ƒοΈ Personal Projects

Feel free to connect with me on the following platforms:

LinkedIn

Check out my personal projects!

About

SQL Server and Power BI analytics project built on the AdventureWorks2022 database, featuring advanced T-SQL data modeling, profitability analysis, RFM customer segmentation, Pareto analysis, demographic & firmographic enrichment, sales channel analytics, and interactive business intelligence dashboards.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors