RANK() window function on aggregated data
Quick exec view — rank cost centers by 2025 OpEx spend YTD. Columns: `cost_center_name`, `total_opex`, `rank`. Highest spender is rank 1. Posted only.
Each hint you reveal reduces the XP you can earn. Try the query first.
Aggregate per cost center: SUM(amount) WHERE OpEx and 2025 and posted.
Apply `RANK() OVER (ORDER BY total_opex DESC) AS rank`.
8 rows — every cost center has some 2025 OpEx.