Consumer Lending Analyst Path · Mission 25 of 30Expert

Cumulative loss curve by vintage × months-to-charge-off

Three-CTE pipeline + window SUM with PARTITION BY for cumulative cohort loss progression

The Brief

Marcus HollandChief Credit Officerconsumer-lending

Vintage curve for the loss-forecasting deck. By vintage year and months-to-charge-off (the gap between funded_date and closed_date for charge_off loans), build a cumulative loss curve. Six columns: `vintage_year`, `months_to_co`, `co_count` (chargeoffs at this exact month-mark), `cum_co` (running total within the vintage), `vintage_size` (total loans in the vintage, denominator), `cum_co_rate` (running CO rate, 4 decimals). Filter `funded_date >= '2024-11-01'`. Sort by vintage_year ascending, then months_to_co ascending.

You'll practice

Three-CTE pipelineWindow SUMCumulative ratio

Tables & columns available

lending_originationsfact17 columns
ColumnTypeKey
origination_idINTPK
app_idINTFK → lending_applications
account_idINTFK → retail_accounts
funded_dateTEXT
funded_amountREAL
term_monthsINT
interest_rateREAL
rate_typeTEXT
arm_reset_dateTEXT
fico_at_origINT
dti_at_origREAL
ltv_at_origREAL
property_valueREAL
lo_nameTEXT
channelTEXT
current_statusTEXT
closed_dateTEXT

Hints (3)

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

Hint 1

Three CTEs decompose the work: extract vintage_year and months-to-CO per charge-off loan (EXTRACT-based date arithmetic); total each vintage's size; aggregate CO counts per (vintage, month-mark).

Hint 2

For the running total, reach for a SUM aggregate window function. Two design choices matter: the partition (so the running total restarts per vintage rather than spilling forward across vintages), and the window frame (a running total reads from the start of the partition up through the current row — ROWS rather than RANGE handles tied month-marks cleanly).

Hint 3

Final JOIN to vintage_size so each row carries its denominator. Compute cum_co_rate by dividing the window-summed cumulative by the vintage total — cast to NUMERIC before ROUND or Postgres throws on `double precision`.