RevOps & Sales Analytics Path · Mission 8 of 30Easy

Win rate by sales rep

Conditional aggregation (SUM CASE WHEN) + ratio — the shape of every rate / ratio report in analytics

The Brief

Lina PetrovSales Operations Managersales-ops

Per-rep win rate for the quarterly ops review. Filter to closed deals only (`stage IN ('Closed-Won', 'Closed-Lost')`), join to `revops_users`, and for each rep compute: total closed, wins, win_rate_pct (100 * wins / total_closed, rounded to 1 decimal). Return `full_name`, `total_closed`, `win_rate_pct`. Order by win_rate_pct desc, then total_closed desc. Include only reps with at least one closed deal — we don't need a zero row for reps who are all-open.

You'll practice

CASE aggregationRatio

Tables & columns available

revops_opportunitiesfact10 columns
ColumnTypeKey
opportunity_idINTPK
account_idINTFK → revops_accounts
owner_user_idINTFK → revops_users
nameTEXT
stageTEXT
amountREAL
close_dateTEXT
created_dateTEXT
is_closedINT
is_wonINT
revops_usersdim6 columns
ColumnTypeKey
user_idINTPK
full_nameTEXT
role_titleTEXT
regionTEXT
hire_dateTEXT
statusTEXT

Hints (3)

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

Hint 1

Filter in WHERE: `stage IN ('Closed-Won', 'Closed-Lost')`. Then join users. Group by rep.

Hint 2

Wins: `SUM(CASE WHEN stage = 'Closed-Won' THEN 1 ELSE 0 END)`. Total: `COUNT(*)`. Win rate: `ROUND(100.0 * wins / total_closed, 1)`. The `100.0 *` forces float math — without it you'll get 0 on integer division.

Hint 3

You should see 6 rows — every rep with closed deals. One rep has a perfect 100% win rate across their closed deals (albeit small sample).