Total Revenue
Total Orders
Profit Margin
ROI
Cancellation Rate
Avg Order Value
The Set category drives 39M in revenue — yet carries a 14.59% cancellation rate, the highest of any category. The very products generating the most revenue are simultaneously creating the most financial leakage.
This revealed a core tension: scaling the top category without fixing its fulfilment & quality gaps would be a losing strategy, eroding profit even as revenue grows.
-- Revenue & order summary by category
SELECT
Category,
COUNT(OrderID) AS TotalOrders,
SUM(Amount) AS TotalRevenue,
SUM(CASE WHEN Status = 'Cancelled' THEN Amount ELSE 0 END) AS CancelledRevenue,
SUM(CASE WHEN Status = 'Returned' THEN Amount ELSE 0 END) AS ReturnedRevenue,
ROUND(
SUM(CASE WHEN Status = 'Cancelled' THEN 1.0 ELSE 0 END) / COUNT(*) * 100, 2
) AS CancellationRate
FROM Orders
GROUP BY Category
ORDER BY TotalRevenue DESC;
-- Monthly revenue trend
SELECT
FORMAT(OrderDate, 'yyyy-MM') AS Month,
SUM(Amount) AS MonthlyRevenue,
COUNT(OrderID) AS MonthlyOrders
FROM Orders
WHERE Status NOT IN ('Cancelled', 'Returned')
GROUP BY FORMAT(OrderDate, 'yyyy-MM')
ORDER BY Month;
# Cancellation & return rate heatmap by category
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
pivot = df.pivot_table(
values='OrderID', index='Category',
columns='Status', aggfunc='count', fill_value=0
)
pivot['CancellationRate'] = pivot['Cancelled'] / pivot.sum(axis=1) * 100
pivot['ReturnRate'] = pivot['Returned'] / pivot.sum(axis=1) * 100
sns.heatmap(pivot[['CancellationRate', 'ReturnRate']],
annot=True, fmt='.1f', cmap='YlOrRd')
plt.title('Cancellation & Return Rate by Category')
plt.tight_layout()
plt.show()
# Revenue trend over time
df['OrderDate'] = pd.to_datetime(df['OrderDate'])
monthly = df[df['Status'] == 'Shipped'].groupby(
df['OrderDate'].dt.to_period('M')
)['Amount'].sum()
monthly.plot(kind='line', title='Monthly Revenue Trend',
color='#f97316', linewidth=2)
plt.ylabel('Revenue (₹)')
plt.show()
// Total Profit
Total Profit = [Total Revenue] - [Total Cost] - [Cancelled Loss] - [Returned Loss]
// Profit Margin %
Profit Margin % = DIVIDE([Total Profit], [Total Revenue], 0) * 100
// ROI %
ROI % = DIVIDE([Total Profit], [Total Cost], 0) * 100
// Cancellation Rate %
Cancellation Rate % =
DIVIDE(
CALCULATE(COUNTROWS(Orders), Orders[Status] = "Cancelled"),
COUNTROWS(Orders)
) * 100
// Profit by Fulfillment Channel
Profit by Channel =
CALCULATE(
[Total Profit],
ALLEXCEPT(Orders, Orders[Fulfilment])
)
// Impact Simulation – If Cancellations Reduce by 20%
Projected Profit (Cancel -20%) =
[Total Profit] + [Cancelled Loss] * 0.20
If Returns Reduce by 20%
New Profit: ₹26.1M
If Cancellations Reduce by 20%
New Profit: ₹27.3M
If Both Improve (20% + 10%)
New Profit: ₹26.7M