Finance Path · Mission 24 of 25Expert

Percentile ranking of cost centers

NTILE and PERCENT_RANK window functions

Back to Finance

The Brief

Priya ShahCFOslack-dm

Compensation review prep — rank our 8 cost centers by 2025 YTD OpEx into quartiles, and give me each CC's percent rank. Columns: `cost_center_name`, `total_opex`, `quartile` (1 = highest spenders), `percent_rank`. Posted only.

You'll practice

NTILE()PERCENT_RANK()

Tables available

fact_transactionsdim_accountsdim_cost_centers

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Aggregate OpEx per cost center for 2025 in a subquery.

Hint 2

`NTILE(4) OVER (ORDER BY total_opex DESC)` for quartiles (1 = top).

Hint 3

`PERCENT_RANK() OVER (ORDER BY total_opex DESC)` for the continuous rank (0 = top, 1 = bottom).