Pharma Commercial Analytics Path · Mission 3 of 25Easy

Rx fills per product

First aggregation on fact_rx joined to dim_product. Per-product Rx volume is the headline KPI on every brand-team scorecard — every Hard / Expert / Master mission downstream extends this skeleton.

The Brief

Priya KumarCommercial Analytics Leadslack-dm

Standing brand-team scorecard — I need the headline number for tomorrow's Tuesday review. Across the full 24-month window in fact_rx, give me the total fill count per product. Use brand_name from dim_product so the slide reads cleanly (not product_id). Two columns: brand_name and rx_count. Sort by rx_count descending — incumbents on top, Cardiozin should land mid-pack since it's only been on market 8 months. Don't filter on date or anything else; we want the full window.

You'll practice

GROUP BYCOUNT(*)ORDER BY DESC

Tables & columns available

fact_rxfact9 columns
ColumnTypeKey
rx_idINTPK
hcp_npiTEXTFK → dim_hcp
product_idINTFK → dim_product
plan_idINTFK → dim_payer_plan
fill_dateTEXT
is_new_rxINT
days_supplyINT
quantityINT
copayREAL
dim_productdim6 columns
ColumnTypeKey
product_idINTPK
brand_nameTEXT
generic_nameTEXT
therapeutic_classTEXT
is_launch_brandINT
launch_dateTEXT

Hints (3)

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

Hint 1

Two-table aggregate. You'll need fact_rx (the volume) joined to dim_product (the readable name), grouped by the brand-name column.

Hint 2

Output column name matters — alias COUNT(*) as rx_count so the scorecard slide binds correctly. Two columns total.

Hint 3

ORDER BY rx_count DESC. Cardiozin's launch was 2025-09-01, so it has only ~8 months of fills against incumbents' 24 — expect it mid-pack, not first.