A comprehensive sales data analysis project featuring Python-based data processing and an interactive React dashboard for visualizing Q1 2024 sales performance.
- Overview
- Features
- Project Structure
- Installation
- Usage
- Data Analysis
- Dashboard
- Key Insights
- Technologies Used
- Contributing
- License
This project provides a complete sales analysis solution for Q1 2024 (January-March) including:
- Data Generation: Realistic sample sales data with 5,000+ records
- Data Processing: Python-based cleaning, transformation, and analysis
- Visualizations: 8+ charts covering trends, categories, regions, and customers
- Interactive Dashboard: React-based web application with tabbed navigation
- Business Insights: Actionable recommendations based on data analysis
| Metric | Value |
|---|---|
| Total Revenue | $4,070,016.31 |
| Total Orders | 5,000 |
| Unique Customers | 1,180 |
| Average Order Value | $814.00 |
| Customer Lifetime Value | $3,449.17 |
| Repeat Customer Rate | 94.07% |
- Monthly sales trend analysis with growth calculations
- Product category performance breakdown
- Regional sales comparison across 4 regions
- Customer segmentation (VIP, High Value, Medium Value, Low Value, New)
- Purchase frequency and behavior analysis
- Key Performance Indicators (KPIs) calculation
- 6 Navigation Tabs: Overview, Trends, Categories, Regions, Customers, Insights
- Interactive Charts: Bar charts, pie charts, line charts with hover tooltips
- KPI Cards: Visual summary of key metrics with gradient styling
- Data Tables: Formatted tables with currency and number formatting
- Responsive Design: Works on desktop and mobile devices
All charts are generated automatically and saved to the outputs/ folder:
| Chart | File | Description |
|---|---|---|
| Monthly Revenue | chart_monthly_revenue.png |
Bar chart comparing Jan-Mar revenue |
| Daily Revenue | chart_daily_revenue.png |
Line chart showing daily trends across Q1 |
| Category Distribution | chart_category_distribution.png |
Pie chart of revenue by product category |
| Category Revenue | chart_category_revenue.png |
Horizontal bar chart of category performance |
| Regional Performance | chart_regional_performance.png |
Side-by-side regional comparison |
| Customer Segments | chart_customer_segments.png |
Bar chart of customer distribution |
| Order Distribution | chart_order_distribution.png |
Histogram of order values with mean/median |
| Orders vs AOV | chart_monthly_orders_aov.png |
Combo chart showing orders and average order value |
Monthly revenue comparison showing March as the strongest month
sales-analysis-dashboard/
├── data/
│ └── sales_data_q1_2024.csv # Sample sales dataset (5,000 records)
├── scripts/
│ ├── generate_sample_data.py # Data generation script
│ └── sales_analysis_report.py # Main analysis script
├── dashboard/
│ └── index.html # React dashboard (single file)
├── outputs/
│ ├── chart_monthly_revenue.png # Monthly revenue bar chart
│ ├── chart_daily_revenue.png # Daily revenue trend line chart
│ ├── chart_category_distribution.png # Product category pie chart
│ ├── chart_category_revenue.png # Category revenue horizontal bar chart
│ ├── chart_regional_performance.png # Regional comparison charts
│ ├── chart_customer_segments.png # Customer segment distribution
│ ├── chart_order_distribution.png # Order value histogram
│ ├── chart_monthly_orders_aov.png # Orders vs AOV combo chart
│ └── sales_analysis_report_q1_2024.html # Static HTML report
├── README.md # This file
└── requirements.txt # Python dependencies
- Python 3.8 or higher
- pip package manager
- Modern web browser (Chrome, Firefox, Safari, Edge)
pip install pandas numpy matplotlib seabornOr install from requirements.txt:
pip install -r requirements.txtThe dashboard is a self-contained HTML file with no build step required. Simply open dashboard/index.html in your browser.
python scripts/generate_sample_data.pyThis creates data/sales_data_q1_2024.csv with 5,000 realistic sales records.
python scripts/sales_analysis_report.pyThis will:
- Load and clean the sales data
- Calculate KPIs and metrics
- Generate 8 visualization charts (saved to
outputs/):chart_monthly_revenue.pngchart_daily_revenue.pngchart_category_distribution.pngchart_category_revenue.pngchart_regional_performance.pngchart_customer_segments.pngchart_order_distribution.pngchart_monthly_orders_aov.png
- Create an HTML report (
outputs/sales_analysis_report_q1_2024.html)
Open dashboard/index.html in your web browser:
# macOS
open dashboard/index.html
# Linux
xdg-open dashboard/index.html
# Windows
start dashboard/index.htmlOr serve it locally:
cd dashboard
python -m http.server 8000
# Then visit http://localhost:8000| Column | Type | Description |
|---|---|---|
| order_id | string | Unique order identifier |
| order_date | date | Date of purchase |
| order_month | int | Month (1-3) |
| customer_id | string | Unique customer identifier |
| region | string | Geographic region (North, South, East, West) |
| product_category | string | Product category (7 categories) |
| product_name | string | Specific product name |
| quantity | int | Units purchased |
| unit_price | float | Price per unit |
| total_amount | float | Gross order amount |
| discount | float | Discount applied |
| final_amount | float | Net order amount |
- Data Loading: Import CSV and validate structure
- Data Cleaning: Check for missing values, duplicates, outliers
- KPI Calculation: Compute revenue, orders, AOV, CLV metrics
- Trend Analysis: Monthly aggregation and growth calculations
- Category Analysis: Revenue breakdown by product category
- Regional Analysis: Performance comparison across regions
- Customer Analysis: Segmentation and behavior analysis
- Visualization: Generate charts and export to HTML
The dashboard is organized into 6 tabs:
- 4 KPI cards (Revenue, Orders, Customers, AOV)
- Additional metrics table
- Quick charts for monthly revenue and category distribution
- Monthly performance summary table
- Revenue vs Orders comparison chart
- Average Order Value trend line chart
- Static Chart:
chart_monthly_revenue.png,chart_monthly_orders_aov.png
- Revenue distribution pie chart
- Category revenue bar chart
- Detailed category performance table
- Static Charts:
chart_category_distribution.png,chart_category_revenue.png
- Revenue by region bar chart
- Market share pie chart
- Regional performance metrics table
- Static Chart:
chart_regional_performance.png
- Customer segment distribution
- Revenue by segment analysis
- Detailed segment metrics table
- Static Charts:
chart_customer_segments.png,chart_order_distribution.png
- Key findings cards with icons
- Business recommendations
- Strategic action items
For a standalone HTML report with all charts embedded, open:
outputs/sales_analysis_report_q1_2024.html
This report includes:
- All KPIs and metrics
- All 8 generated charts
- Data tables
- Business insights and recommendations
- Professional styling
To use your own data:
- Replace
data/sales_data_q1_2024.csvwith your dataset - Update the column names in
sales_analysis_report.pyif needed - Re-run the analysis script
- Update the data object in
dashboard/index.html(lines 30-90)
| Monthly Revenue | Daily Revenue Trend |
|---|---|
![]() |
![]() |
| Revenue comparison across Q1 months | Daily revenue fluctuations throughout the quarter |
| Category Distribution | Category Revenue |
|---|---|
![]() |
![]() |
| Pie chart showing market share by category | Horizontal bar chart of revenue by category |
| Regional Performance | Customer Segments |
|---|---|
![]() |
![]() |
| Side-by-side revenue and market share | Customer distribution by value segment |
| Order Distribution | Orders vs AOV |
|---|---|
![]() |
![]() |
| Histogram of order values | Monthly orders and average order value trend |
-
Best Performing Month: March generated $1.40M in revenue (5.5% growth from February)
- See:
chart_monthly_revenue.png
- See:
-
Top Product Category: Electronics dominates with $2.56M (63% of total revenue)
- See:
chart_category_distribution.png,chart_category_revenue.png
- See:
-
Leading Region: East region contributed $1.26M with the highest AOV of $946.66
- See:
chart_regional_performance.png
- See:
-
VIP Customer Impact: 118 VIP customers generated $1.24M, averaging $10,467 per customer
- See:
chart_customer_segments.png
- See:
-
Customer Loyalty: 94.07% repeat customer rate indicates strong retention
- See:
chart_order_distribution.pngfor purchase patterns
- See:
- Focus on High-Value Categories: Expand Electronics and Home & Garden product variety
- Optimize Regional Strategies: Apply East/North tactics to South/West regions
- Nurture VIP Customers: Implement loyalty programs and exclusive offers
- Increase Purchase Frequency: Use email marketing to drive repeat purchases
- Monitor Seasonal Trends: Optimize inventory and staffing based on patterns
- Review Discount Strategy: Evaluate if strategic discounts could drive volume
- Python 3.8+: Core programming language
- Pandas: Data manipulation and analysis
- NumPy: Numerical computing
- Matplotlib: Static visualizations
- Seaborn: Statistical data visualization
- React 18: UI library
- Tailwind CSS: Utility-first CSS framework
- Recharts: Composable charting library
- Babel: JavaScript compiler (in-browser)
- Git: Version control
- GitHub: Repository hosting
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Additional Visualizations: New chart types or interactive features
- Data Export: Add export to Excel/CSV functionality
- Dashboard UI: Improve styling, add dark mode
- Documentation: Expand README with more examples
- Bug Fixes: Report issues or submit fixes
To add a new visualization:
- Add chart generation code to
sales_analysis_report.py:
# Example: New chart
fig, ax = plt.subplots(figsize=(10, 6))
# ... chart code ...
plt.savefig(f"{output_dir}/chart_new_visualization.png")- Reference the chart in this README:

*Description of the new chart*- Update the dashboard (
dashboard/index.html) to include the new chart data
This project is licensed under the MIT License - see the LICENSE file for details.
- Sample data generated for demonstration purposes
- Charts powered by Recharts
- Styling with Tailwind CSS
For questions or feedback, please open an issue on GitHub.
Note: This project uses sample data for demonstration. Replace with your actual sales data for production use.







