Use AVG with GROUP BY to compare campaign efficiency
I want to compare campaigns by average order value, not just total revenue. Can you pull campaign_name, order count, and average order value? Exclude refunds. Sort by AOV descending.
Each hint you reveal reduces the XP you can earn. Try the query first.
JOIN `fact_purchases` to `dim_campaigns` on `campaign_id` and filter `WHERE p.amount > 0`
Use `AVG(p.amount)` for average order value — round it with `ROUND(AVG(p.amount)::numeric, 2) AS avg_order_value`
Also include `COUNT(*) AS orders` and GROUP BY campaign_name. Sort by avg_order_value DESC