Pharma Commercial Analytics Path · Mission 5 of 25Easy

Payer mix — Rx count per plan_type

First two-table join: fact_rx to dim_payer_plan on plan_id. Payer mix (commercial vs Medicare vs Medicaid) is the headline shape behind every market access strategy and gross-to-net forecast. INNER JOIN on a fact, GROUP BY on a dim attribute.

The Brief

Lin ParkMarket Access Directorslack-dm

Market access steering at 3pm needs a clean payer-mix read. From fact_rx joined to dim_payer_plan, give me Rx count grouped by plan_type — Commercial, Medicare D, Medicaid, and Cash should all show. Two columns: plan_type, rx_count. Sort by rx_count descending so commercial leads (it always does). Note: a small number of fact_rx rows have NULL plan_id from the documentation gap I'm flagging in this week's data-quality review — INNER JOIN drops those automatically, which is what we want here.

You'll practice

INNER JOINGROUP BYCOUNT(*)

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_payer_plandim4 columns
ColumnTypeKey
plan_idINTPK
plan_nameTEXT
plan_typeTEXT
formulary_tierINT

Hints (3)

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

Hint 1

Two-table INNER JOIN: fact_rx to dim_payer_plan on plan_id. The INNER JOIN handles the NULL-plan_id rows automatically — they get dropped, which is what Lin wants.

Hint 2

Group by the dim's plan_type attribute and count. Two-column output.

Hint 3

Sort descending on the count so commercial leads — that's where the steering meeting builds its narrative.