A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.
Shell
Fix Analytics Reporter PostgreSQL dashboard and conversion totals
Rudy Celekli240e99fed870
diff --git a/support/support-analytics-reporter.md b/support/support-analytics-reporter.mdindex a790a4a2..84d282b7 100644--- a/support/support-analytics-reporter.md+++ b/support/support-analytics-reporter.md@@ -55,23 +55,23 @@ You are **Analytics Reporter**, an expert data analyst and reporting specialist### Executive Dashboard Template```sql--- Key Business Metrics Dashboard+-- PostgreSQL: Key Business Metrics DashboardWITH monthly_metrics AS (SELECTDATE_TRUNC('month', date) as month,SUM(revenue) as monthly_revenue,COUNT(DISTINCT customer_id) as active_customers,AVG(order_value) as avg_order_value,- SUM(revenue) / COUNT(DISTINCT customer_id) as revenue_per_customer+ SUM(revenue) * 1.0 / NULLIF(COUNT(DISTINCT customer_id), 0) as revenue_per_customerFROM transactions- WHERE date >= DATE_SUB(CURRENT_DATE(), INTERVAL 12 MONTH)+ WHERE date >= CURRENT_DATE - INTERVAL '12 months'GROUP BY DATE_TRUNC('month', date)),growth_calculations AS (SELECT *,LAG(monthly_revenue, 1) OVER (ORDER BY month) as prev_month_revenue,- (monthly_revenue - LAG(monthly_revenue, 1) OVER (ORDER BY month)) /- LAG(monthly_revenue, 1) OVER (ORDER BY month) * 100 as revenue_growth_rate+ (monthly_revenue - LAG(monthly_revenue, 1) OVER (ORDER BY month)) * 100.0 /+ NULLIF(LAG(monthly_revenue, 1) OVER (ORDER BY month), 0) as revenue_growth_rateFROM monthly_metrics)SELECT@@ -82,6 +82,7 @@ SELECTrevenue_per_customer,revenue_growth_rate,CASE+ WHEN revenue_growth_rate IS NULL THEN 'No Comparable Baseline'WHEN revenue_growth_rate > 10 THEN 'High Growth'WHEN revenue_growth_rate > 0 THEN 'Positive Growth'ELSE 'Needs Attention'@@ -212,18 +213,18 @@ const marketingDashboard = {ORDER BY attributed_revenue DESC;`,- // Campaign ROI calculation+ // PostgreSQL campaign ROI: conversions is the per-row numeric total.campaignROI: `SELECTcampaign_name,SUM(spend) as total_spend,SUM(attributed_revenue) as total_revenue,- (SUM(attributed_revenue) - SUM(spend)) / SUM(spend) * 100 as roi_percentage,- SUM(attributed_revenue) / SUM(spend) as revenue_multiple,- COUNT(conversions) as total_conversions,- SUM(spend) / COUNT(conversions) as cost_per_conversion+ (SUM(attributed_revenue) - SUM(spend)) * 100.0 / SUM(spend) as roi_percentage,+ SUM(attributed_revenue) * 1.0 / SUM(spend) as revenue_multiple,+ SUM(conversions) as total_conversions,+ SUM(spend) * 1.0 / NULLIF(SUM(conversions), 0) as cost_per_conversionFROM campaign_performance- WHERE date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)+ WHERE date >= CURRENT_DATE - INTERVAL '90 days'GROUP BY campaign_nameHAVING SUM(spend) > 1000 -- Filter for significant spendORDER BY roi_percentage DESC;