Use GROUP BY with SUM to aggregate revenue by category
Can you pull a quick breakdown of purchases by product category? I need the category name, number of purchases, and total revenue for each. Sort by revenue so I can see what's making the most money.
Each hint you reveal reduces the XP you can earn. Try the query first.
Group `fact_purchases` by `product_category` and use `COUNT(*)` for purchases and `SUM(amount)` for revenue
Filter out refunds first with `WHERE amount > 0` — negative amounts are returns that would skew your totals
Alias your columns: `COUNT(*) AS purchases, ROUND(SUM(amount)::numeric, 2) AS total_revenue` and sort by revenue DESC