Python SQL JavaScript

Sales Analytics Dashboard

// data pipeline: SQLite → Python (pandas) → REST API → JavaScript (Chart.js)

📄 query.sql — Aggregation Query
-- Aggregate monthly sales by category with YoY growth SELECT s.category, SUM(s.revenue) AS total_revenue, COUNT(s.order_id) AS total_orders, AVG(s.revenue) AS avg_order_value, ROUND(((SUM(s.revenue) - LAG(SUM(s.revenue)) OVER ( PARTITION BY s.category ORDER BY s.month )) / LAG(SUM(s.revenue)) OVER ( PARTITION BY s.category ORDER BY s.month )) * 100, 2) AS growth_pct FROM sales s JOIN products p ON s.product_id = p.id WHERE s.month BETWEEN '2024-01' AND '2024-12' GROUP BY s.category, s.month ORDER BY total_revenue DESC;
Total Revenue
₹84.2L
↑ 12.4% vs last year
Total Orders
3,482
↑ 8.1% growth
Avg Order Value
₹2,419
↑ 3.9% increase
Churn Rate
4.2%
↓ improved by 1.1%
Monthly Revenue Trend
FY 2024 — grouped by category
Revenue by Category
Pie distribution
Top 5 Products — Avg Order Value
Bar chart
Query Results — Category Summary
// 6 rows returned in 0.024s
Category Total Revenue Orders Avg Value Growth % Status
Electronics₹28,40,000892₹3,184+18.4%Active
Fashion₹19,60,0001,124₹1,744+9.2%Active
Home & Kitchen₹14,20,000648₹2,191+12.1%Active
Books₹9,80,000432₹2,269-2.4%Review
Sports₹7,60,000286₹2,657+6.7%Active
Toys₹4,60,000100₹4,600-5.1%Review