Sales Data Analysis Example
Comprehensive e-commerce sales analysis demonstrating aggregation, filtering, and visualization techniques.
Dataset Overview
Sample Data: Representative transactions across 5 regions and 5 product categories Columns: date, region, category, quantity, unit_price, total_sales
1. Total Sales by Region
Simple bar chart showing regional sales performance:
View Source
type: bar
title: Total Sales by Region
x: region
y: total_sales
width: 600
height: 400
data:
source: '[{"region": "North", "total_sales": 125000}, {"region": "South", "total_sales": 98000}, {"region": "East", "total_sales": 112000}, {"region": "West", "total_sales": 87000}, {"region": "Central", "total_sales": 104000}]'2. Sales Performance by Product Category
Compare performance across product categories:
View Source
type: bar
title: Sales by Product Category
x: category
y: revenue
width: 600
height: 400
data:
source: '[{"category": "Electronics", "revenue": 185000, "num_transactions": 1250}, {"category": "Clothing", "revenue": 142000, "num_transactions": 2100}, {"category": "Food", "revenue": 98000, "num_transactions": 3200}, {"category": "Books", "revenue": 67000, "num_transactions": 1800}, {"category": "Home & Garden", "revenue": 134000, "num_transactions": 1150}]'3. Regional Performance Heatmap
Compare regions and categories in a heatmap:
View Source
type: heatmap
engine: d3
title: Sales Heatmap - Region vs Category
x: region
y: category
color: sales
width: 600
height: 400
data:
source: '[{"region": "North", "category": "Electronics", "sales": 42000}, {"region": "North", "category": "Clothing", "sales": 28000}, {"region": "North", "category": "Food", "sales": 18000}, {"region": "North", "category": "Books", "sales": 15000}, {"region": "North", "category": "Home & Garden", "sales": 22000}, {"region": "South", "category": "Electronics", "sales": 35000}, {"region": "South", "category": "Clothing", "sales": 24000}, {"region": "South", "category": "Food", "sales": 16000}, {"region": "South", "category": "Books", "sales": 11000}, {"region": "South", "category": "Home & Garden", "sales": 12000}, {"region": "East", "category": "Electronics", "sales": 38000}, {"region": "East", "category": "Clothing", "sales": 32000}, {"region": "East", "category": "Food", "sales": 22000}, {"region": "East", "category": "Books", "sales": 8000}, {"region": "East", "category": "Home & Garden", "sales": 12000}, {"region": "West", "category": "Electronics", "sales": 28000}, {"region": "West", "category": "Clothing", "sales": 22000}, {"region": "West", "category": "Food", "sales": 15000}, {"region": "West", "category": "Books", "sales": 12000}, {"region": "West", "category": "Home & Garden", "sales": 10000}, {"region": "Central", "category": "Electronics", "sales": 42000}, {"region": "Central", "category": "Clothing", "sales": 36000}, {"region": "Central", "category": "Food", "sales": 27000}, {"region": "Central", "category": "Books", "sales": 21000}, {"region": "Central", "category": "Home & Garden", "sales": 78000}]'4. Top 10 Performing Region-Category Combinations
Find the highest performing region-category combinations:
View Source
type: bar
title: Top 10 Region-Category Combinations
x: combination
y: sales
width: 700
height: 400
data:
source: '[{"combination": "Central - Home & Garden", "sales": 78000}, {"combination": "North - Electronics", "sales": 42000}, {"combination": "Central - Electronics", "sales": 42000}, {"combination": "East - Electronics", "sales": 38000}, {"combination": "Central - Clothing", "sales": 36000}, {"combination": "South - Electronics", "sales": 35000}, {"combination": "East - Clothing", "sales": 32000}, {"combination": "North - Clothing", "sales": 28000}, {"combination": "West - Electronics", "sales": 28000}, {"combination": "Central - Food", "sales": 27000}]'5. Transaction Count by Region
How many transactions occur in each region:
View Source
type: bar
title: Transaction Volume by Region
x: region
y: transaction_count
width: 600
height: 400
data:
source: '[{"region": "North", "transaction_count": 1850}, {"region": "South", "transaction_count": 1420}, {"region": "East", "transaction_count": 1680}, {"region": "West", "transaction_count": 1290}, {"region": "Central", "transaction_count": 2260}]'6. Average Order Value by Category
Which product categories have higher average transaction values:
View Source
type: bar
title: Average Order Value by Category
x: category
y: avg_order_value
width: 600
height: 400
data:
source: '[{"category": "Electronics", "avg_order_value": 148}, {"category": "Home & Garden", "avg_order_value": 117}, {"category": "Clothing", "avg_order_value": 68}, {"category": "Books", "avg_order_value": 37}, {"category": "Food", "avg_order_value": 31}]'7. Quantity Sold by Category
Total units sold in each product category:
View Source
type: bar
title: Units Sold by Category
x: category
y: total_units
width: 600
height: 400
data:
source: '[{"category": "Food", "total_units": 12500}, {"category": "Clothing", "total_units": 8200}, {"category": "Books", "total_units": 5400}, {"category": "Home & Garden", "total_units": 3200}, {"category": "Electronics", "total_units": 2100}]'8. Monthly Sales Trend
Track total sales over time by month:
View Source
type: line
title: Monthly Sales Trend
x: month
y: monthly_revenue
width: 700
height: 400
data:
source: '[{"month": "2024-01", "monthly_revenue": 42000}, {"month": "2024-02", "monthly_revenue": 38000}, {"month": "2024-03", "monthly_revenue": 45000}, {"month": "2024-04", "monthly_revenue": 52000}, {"month": "2024-05", "monthly_revenue": 48000}, {"month": "2024-06", "monthly_revenue": 55000}, {"month": "2024-07", "monthly_revenue": 62000}, {"month": "2024-08", "monthly_revenue": 58000}, {"month": "2024-09", "monthly_revenue": 51000}, {"month": "2024-10", "monthly_revenue": 48000}, {"month": "2024-11", "monthly_revenue": 65000}, {"month": "2024-12", "monthly_revenue": 72000}]'9. Regional Revenue Distribution
Pie chart showing relative contribution of each region:
View Source
type: pie
title: Revenue Distribution by Region
x: region
y: regional_revenue
width: 500
height: 500
data:
source: '[{"region": "North", "regional_revenue": 125000}, {"region": "South", "regional_revenue": 98000}, {"region": "East", "regional_revenue": 112000}, {"region": "West", "regional_revenue": 87000}, {"region": "Central", "regional_revenue": 104000}]'10. Category Performance Scatter
Compare average order value vs transaction volume:
View Source
type: scatter
title: Category Performance (AOV vs Volume)
x: num_transactions
y: avg_order_value
color: category
width: 600
height: 400
data:
source: '[{"category": "Electronics", "avg_order_value": 148, "num_transactions": 1250}, {"category": "Clothing", "avg_order_value": 68, "num_transactions": 2100}, {"category": "Food", "avg_order_value": 31, "num_transactions": 3200}, {"category": "Books", "avg_order_value": 37, "num_transactions": 1800}, {"category": "Home & Garden", "avg_order_value": 117, "num_transactions": 1150}]'Key Metrics from Sales Data
| Metric | Value |
|---|---|
| Total Revenue | $526,000 |
| Average Order Value | $62 |
| Transaction Count | 8,500 |
| Top Region | North ($125K) |
| Top Category | Electronics ($185K) |
Analysis Techniques Demonstrated
- Aggregation: Group by single and multiple dimensions
- Ranking: Sort to find top performers
- Comparisons: Side-by-side bar charts across categories
- Trends: Monthly aggregations show seasonal patterns
- Proportions: Pie charts show relative contribution
- Multi-dimensional: Heatmaps show region × category interaction
- Correlation: Scatter plots reveal relationships
Business Insights
- Regional Performance: North and Central regions lead in revenue
- Product Performance: Electronics has highest revenue despite fewer transactions
- Seasonal Patterns: Holiday months (Nov-Dec) show peak sales
- Volume vs. Value: Food has high volume but low per-transaction value
- Cross-sell Opportunities: Central region shows strong Home & Garden performance