Skip to content

Swapnika29/sales-inventory-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retail Sales & Delivery Performance Dashboard (BigQuery + Power BI)

This project analyzes Brazilian e-commerce sales and delivery performance using the Olist dataset, with an end-to-end workflow built using Python, Google BigQuery, SQL, and Power BI. The goal is to provide stakeholders with actionable insights on sales trends, category performance, delivery reliability, and state-level revenue distribution.

Table of Contents


Introduction

This project was built as a portfolio-quality Data Analyst project to demonstrate:

  • End-to-end data ingestion and transformation
  • SQL-based KPI modeling in BigQuery
  • Power BI data modeling (relationships, dimensions, DAX measures)
  • Interactive dashboard design with slicers, Top-N analysis, trends, and geospatial visuals

The dashboard focuses on:

  • Monthly sales performance (Orders, Revenue, AOV)
  • Delivery performance (On-time Rate, Avg Delivery Days)
  • Category-level revenue and trends
  • State-level ranking and geographic performance mapping

Dataset

The project uses the Olist Brazilian E-Commerce Public Dataset (Kaggle), which includes order, payment, review, product, customer, seller, and geolocation data.

Key source tables used

  • olist_orders_dataset.csv
  • olist_order_items_dataset.csv
  • olist_order_payments_dataset.csv
  • olist_order_reviews_dataset.csv
  • olist_products_dataset.csv
  • olist_customers_dataset.csv
  • olist_sellers_dataset.csv
  • olist_geolocation_dataset.csv
  • product_category_name_translation.csv

Data Pipeline and Modeling

This project follows a layered data architecture in BigQuery:

1) Raw Layer (retail_analytics)

CSV files are loaded into BigQuery raw tables using a Python batch ingestion script.

2) Staging Layer (retail_staging)

SQL transformations clean and standardize raw tables into staging tables (stg_*).

3) Mart Layer (retail_mart)

Business-ready modeled tables are created (including a sales fact table used for KPI derivation).

4) KPI Layer (retail_kpi)

Aggregated reporting views used directly in Power BI:

  • kpi_monthly_sales
  • kpi_category_monthly
  • kpi_state_monthly

Power BI Modeling Highlights

  • DimDate / DimMonth dimensions for time analysis
  • Relationships across KPI tables
  • Dedicated _Measures table for DAX measures
  • Weighted KPI calculations to avoid incorrect aggregations for averages/rates
  • Synced slicers across dashboard pages

Power BI Dashboard

A 3-page interactive Power BI dashboard was built to support exploratory and executive-style analysis.

Dashboard Pages

  1. Overview

    • Monthly KPI cards (Orders, Revenue, AOV, On-time Rate, Avg Delivery Days)
    • Orders and Revenue trends by month
    • Monthly KPI detail table
  2. Category Performance

    • Top categories by revenue (Top-N bar chart)
    • Category KPI table (Orders, Revenue, AOV)
    • Revenue trend (Top 5 categories) for readability
    • Category and month slicers
  3. State Performance

    • Top states by revenue
    • State revenue filled map (Brazil geocoding fixed using helper column)
    • Revenue trend for selected state
    • State KPI detail table
    • State and month slicers

Dashboard Screenshots

1) Overview Page

Overview Page

2) Category Performance Page

Category Performance Page

3) State Performance Page

State Performance Page


How to Run

Prerequisites

  • Google Cloud project with BigQuery API enabled
  • Service account key JSON
  • Python 3.x
  • Power BI Desktop
  • Olist dataset CSV files downloaded locally

1) Clone the repository

git clone <your-repo-url>
cd sales-inventory-dashboard

2) Create and Activate Virtual Environment

Windows (PowerShell)

python -m venv .venv
.venv\Scripts\Activate.ps1

If script execution is blocked:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Then activate again:

.venv\Scripts\Activate.ps1

macOS / Linux

python3 -m venv .venv
source .venv/bin/activate

3) Install dependencies

pip install -r requirements.txt

4) Configure environment variables

Create a .env file in the project root:

GOOGLE_APPLICATION_CREDENTIALS=C:\Users\yourname\Downloads\your-service-account-key.json
GCP_PROJECT_ID=sales-inventory-dashboard
BQ_RAW_DATASET=retail_analytics
BQ_STAGING_DATASET=retail_staging
BQ_MART_DATASET=retail_mart
BQ_KPI_DATASET=retail_kpi

5) (Optional) Test BigQuery connection

python src/00_bq_smoke_test.py

6) Place Olist CSV files in local raw folder

Example: data/raw/

7) Run ingestion script (CSV → BigQuery raw tables)

python src/load_olist_to_bigquery.py

8) Run SQL transformations in BigQuery

Execute saved queries / SQL scripts for:

  • staging layer
  • mart layer
  • KPI layer

Note: In this project, the SQL transformations were initially developed and saved as BigQuery saved queries. They can be exported and organized into local .sql files under sql/staging, sql/mart, and sql/kpi for version control.

9) Open Power BI Desktop and connect to BigQuery

Load:

  • kpi_monthly_sales
  • kpi_category_monthly
  • kpi_state_monthly

Then refresh the model and open the .pbix dashboard file.

Results and Insights

Key outcomes from the dashboard

  • Built an interactive KPI monitoring workflow for sales + delivery performance
  • Enabled Top-N category and state analysis for faster revenue concentration insights
  • Created trend-based views for month-over-month performance tracking
  • Added a state revenue map with corrected Brazil geocoding using a helper field (StateCountry = [state] & ", Brazil")

Technical lessons learned

  • Correct handling of averages and rates in Power BI using DAX measures (instead of summing monthly aggregates)
  • BigQuery → Power BI integration and modeling across multiple KPI views
  • Visual interaction tuning (e.g., keeping Top-N charts stable while allowing detailed slicer-driven analysis)

Future Work

  • Add scheduled refresh / scheduled queries in BigQuery
  • Add data quality checks (nulls, duplicates, schema validation)
  • Add inventory proxy metrics (since Olist is not a true inventory dataset)
  • Add executive one-page summary with recommendations
  • Export and version all BigQuery SQL queries into local .sql files for reproducibility

Project Structure (Suggested)

sales-inventory-dashboard/
├── README.md
├── .gitignore
├── requirements.txt
├── src/
│   ├── 00_bq_smoke_test.py
│   └── load_olist_to_bigquery.py
├── sql/
│   ├── staging/
│   ├── mart/
│   ├── kpi/
│   └── validation/
├── powerbi/
│   └── Retail_Sales_Delivery_Dashboard_PowerBI.pbix
├── screenshots/
│   ├── overview_page.png
│   ├── category_performance_page.png
│   └── state_performance_page.png
├── data/
│   └── README.md   # optional (document where to place source CSVs)
└── docs/           # optional

Author

Bala Swapnika Gopi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages