Business Intelligence Path · Mission 24 of 25Expert

Percentile ranking across the sales force

Use NTILE() and PERCENT_RANK() window functions for distribution analysis

Back to Business Intelligence

The Brief

Marcus WebbVP of Salessales-ops

I need to segment our active sales reps into performance quartiles based on total revenue. Show each rep's name, total revenue, their quartile (1=top 25%, 4=bottom 25%), and their percentile rank (0 to 1 scale). I'm trying to identify who's in the bottom quartile for coaching and who's in the top quartile for promotion consideration.

You'll practice

NTILE()PERCENT_RANK()

Tables available

fact_salesdim_employees

Hints (3)

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

Hint 1

First aggregate total revenue per active Sales rep in a subquery

Hint 2

Apply NTILE(4) OVER (ORDER BY total_revenue DESC) for quartiles (1 = highest revenue)

Hint 3

Apply PERCENT_RANK() OVER (ORDER BY total_revenue DESC) for percentile — it returns 0 for the top performer and 1 for the bottom