https://github.com/faisal-khann/vendor-performance-analysis
https://github.com/faisal-khann/vendor-performance-analysis
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/faisal-khann/vendor-performance-analysis
- Owner: Faisal-khann
- License: mit
- Created: 2025-07-26T21:45:07.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T07:44:30.000Z (2 months ago)
- Last Synced: 2025-07-28T08:43:52.476Z (2 months ago)
- Language: Jupyter Notebook
- Size: 2.22 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📦 Vendor Performance Analysis Project
Effective inventory and sales management is crucial for optimizing profitability in the retail and wholesale sectors. This project aims to help businesses identify inefficiencies in pricing, vendor performance, and inventory turnover to enhance decision-making and overall profitability.
---
## Project Workflow
## Business Problem
Companies often face losses due to poor inventory practices, inefficient pricing strategies, and vendor over-dependence. This analysis aims to:
- Identify underperforming brands needing promotional or pricing adjustments.
- Determine top vendors contributing to sales and gross profit.
- Analyze the effect of bulk purchasing on unit cost.
- Assess inventory turnover to improve efficiency and reduce holding costs.
- Investigate profitability variance between high- and low-performing vendors## Tools & Technologies
| Tool | Purpose |
|-------------|----------------------------------|
| **Python** | Data analysis & scripting |
| **Pandas** | Data manipulation |
| **SQL** | Data extraction from SQLite |
| **Power BI**| Dashboard creation |
| **Jupyter** | EDA & visualization |
| **Matplotlib/Seaborn** | Visual analytics |---
## Database Connection
To run the analysis, establish a connection to the SQLite database:
```python
from sqlalchemy import create_engine
import pandas as pd
import sqlite3# Create a SQLAlchemy engine to connect to the SQLite database named 'inventory.db'
engine = create_engine('sqlite:///inventory.db')# Connect to the SQLite database file
conn = sqlite3.connect('inventory.db')# Checking tables present in the database
tables = pd.read_sql_query(
"SELECT name FROM sqlite_master
WHERE type='table' ORDER BY name ASC", conn
)
tables```
## Data Aggregation using SQL (Final Query)
The query below creates the final `vendor_sales_summary` by joining purchase, sales, and freight data using Common Table Expressions (CTEs):```python
vendor_sales_summary = pd.read_sql_query("""
WITH FreightSummary AS (
SELECT
VendorNumber,
SUM(Freight) AS FreightCost
FROM vendor_invoice
GROUP BY VendorNumber
),
PurchaseSummary AS (
SELECT
p.VendorNumber,
p.VendorName,
p.Brand,
p.Description,
p.PurchasePrice,
pp.Volume,
pp.Price AS ActualPrice,
SUM(p.Quantity) AS TotalPurchaseQuantity,
SUM(p.Dollars) AS TotalPurchaseDollars
FROM purchases p
JOIN purchase_prices pp
ON p.Brand = pp.Brand
WHERE p.PurchasePrice > 0
GROUP BY
p.VendorNumber, p.VendorName, p.Brand, p.Description, p.PurchasePrice, pp.Price, pp.Volume
),
SalesSummary AS (
SELECT
VendorNo,
Brand,
SUM(SalesDollars) AS TotalSalesDollars,
SUM(SalesPrice) AS TotalSalesPrice,
SUM(SalesQuantity) AS TotalSalesQuantity,
SUM(ExciseTax) AS TotalExciseTax
FROM sales
GROUP BY VendorNo, Brand
)
SELECT
ps.VendorNumber,
ps.VendorName,
ps.Brand,
ps.Description,
ps.PurchasePrice,
ps.ActualPrice,
ps.Volume,
ps.TotalPurchaseQuantity,
ps.TotalPurchaseDollars,
ss.TotalSalesQuantity,
ss.TotalSalesDollars,
ss.TotalSalesPrice,
ss.TotalExciseTax,
fs.FreightCost
FROM PurchaseSummary ps
LEFT JOIN SalesSummary ss
ON ps.VendorNumber = ss.VendorNo
AND ps.Brand = ss.Brand
LEFT JOIN FreightSummary fs
ON ps.VendorNumber = fs.VendorNumber
ORDER BY ps.TotalPurchaseDollars DESC
""", conn)```
## 📂 Folder Structure
```
Vendor_Performance_Analysis/
│
├── data/
│ └── inventory.db # SQLite database
│
├── sql/ # SQL scripts for data cleaning and aggregation
│
├── notebooks/
│ └── Vendor_Performance_Analysis.ipynb # Main notebook
│
│
├── logs/
│ └── ingestion.log # Logs for ETL operations
│
├── scripts/
│ └── ingest_to_db.py # Save aggregated table to DB
│
├── powerbi/
│ └── dashboard.pbix # Power BI dashboard file
│
├── report/
│ └── final_report.pdf # Business summary
│
└── README.md # Project documentation
```---
## Data Pipeline Overview
```mermaid
graph TD;
A[Define Business Problem] --> B[Explore DB with SQL];
B --> C[Clean & Merge Tables];
C --> D[Create Aggregated Table];
D --> E[Save to SQLite DB];
D --> F[Load in Jupyter];
F --> G[Perform EDA];
G --> H[Create Power BI Dashboard];
H --> I[Report Insights];
```---
## Power BI Dashboard Preview
Below is a preview of the Power BI dashboard showing key vendor KPIs:
![]()
> 📁 File: [`Inventory_Management.pbix`](https://app.powerbi.com/view?r=eyJrIjoiNTA4MzAyYjctNTY4NC00YzNlLWEzMGUtMDc4ZTdkNDhkOWVjIiwidCI6IjQyYjUxMzUzLTZhMzctNDA5Zi1hMmZlLTc3OGE5YmUzMTllNCJ9)
---
## Report Summary
The final report contains:
- Project Goals
- Analysis Methodology
- Key Insights
- Recommendations📁 File: `report/final_report.pdf`
---
## Outcomes & Insights
- Identified top and low-performing vendors based on delivery time and rating
- Highlighted cost-effectiveness of certain vendors
- Suggested potential areas for renegotiation and vendor replacement
---
## Resources
- Full Jupyter Notebook: [`Vendor_Performance_Analysis.ipynb`](notebooks/Vendor_Performance_Analysis.ipynb)
## Author
**Faisal Khan**
*Data Analyst | Python | SQL | Power BI | Machine learnig*📧 Contact: *thisside.faisalkhan@example.com*
🔗 GitHub: [github.com/yourusername](https://github.com/Faisal-khann)