End-to-end analysis of 3.5M payment transactions — from raw SQL queries to Python visualizations to a live Power BI dashboard — surfacing failure root causes and quantifying revenue recovery opportunities.
Python (Pandas + Matplotlib/Seaborn) was used on the full 3.5M row dataset to identify failure patterns across payment methods, time windows, transaction amounts, and error codes. The daily trend chart confirms 6 months of continuous data from Jul 2025 to Jan 2026.
Six structured SQL queries drill from overall baseline down to error-level root cause. Click any query to expand.
SELECT
COUNT(*) AS Total_Transactions,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS Failed_Transactions,
ROUND(
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2
) AS Failure_Rate_Percentage
FROM payment_data;
SELECT
SUM(amount) AS Total_Revenue,
SUM(CASE WHEN status = 'failed' THEN amount ELSE 0 END) AS Failed_Revenue,
ROUND(
SUM(CASE WHEN status = 'failed' THEN amount ELSE 0 END) * 100.0 / SUM(amount), 2
) AS Revenue_Loss_Percentage
FROM payment_data;
SELECT
payment_method,
COUNT(*) AS Total_Transactions,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS Failed_Transactions,
ROUND(
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2
) AS Failure_Rate_Percentage
FROM payment_data
GROUP BY payment_method
ORDER BY Failure_Rate_Percentage DESC;
SELECT
is_peak_hour,
COUNT(*) AS Total_Transactions,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS Failed_Transactions,
ROUND(
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2
) AS Failure_Rate_Percentage
FROM payment_data
GROUP BY is_peak_hour;
SELECT
gateway,
COUNT(*) AS Total_Transactions,
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS Failed_Transactions,
ROUND(
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2
) AS Failure_Rate_Percentage,
AVG(response_time_ms) AS Avg_Response_Time
FROM payment_data
GROUP BY gateway
ORDER BY Failure_Rate_Percentage;
SELECT
error_code,
COUNT(*) AS Failed_Transactions,
ROUND(
COUNT(*) * 100.0 / (SELECT COUNT(*) FROM payment_data WHERE status = 'failed'), 2
) AS Percentage_Of_Failures
FROM payment_data
WHERE status = 'failed'
GROUP BY error_code
ORDER BY Failed_Transactions DESC
LIMIT 6;
Multi-page Power BI report covering KPIs, deep failure analysis with day × hour hotspot matrix, and a structured action plan. Scroll to explore all three pages — click to expand.
I turn raw transaction data into patterns, dashboards, and decisions.
Let's Work Together → Download Dashboard PDF