Consumer Lending Analyst Path · Mission 19 of 30Hard

Delinquency progression: first miss × current status

Multi-CTE cohort definition + 2-dim GROUP BY pivot to surface monotonic status progression

The Brief

Tony CostaLoan Servicing Leadconsumer-lending

Roll-progression view for the monthly servicing review. For every loan that ever missed a payment, find the month of the first miss, then bucket against the loan's `current_status` today. Three columns: `first_miss_month` ('YYYY-MM'), `current_status`, `loan_count`. Filter `first_miss_date >= '2024-11-01'` to skip the 2019 cohort. Sort by first_miss_month ascending, then current_status ascending.

You'll practice

Multi-CTEMIN-aggregation cohortStatus pivot

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
lending_paymentsfact10 columns
ColumnTypeKey
payment_idINTPK
origination_idINTFK → lending_originations
due_dateTEXT
paid_dateTEXT
scheduled_amountREAL
principal_paidREAL
interest_paidREAL
escrow_paidREAL
days_lateINT
statusTEXT

Hints (3)

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

Hint 1

First CTE: per origination, find the date of the first miss using a MIN aggregate filtered to the missed status. One row per loan that ever missed.

Hint 2

Outer SELECT: JOIN that CTE back to `lending_originations` so each loan's `current_status` rides along. GROUP BY two dimensions — bucketed first-miss month (DATE_TRUNC + TO_CHAR) and current_status — and COUNT.

Hint 3

Two-key sort (month asc, status asc) gives the chronological reading order plus a deterministic tie-break when two months happen to have the same set of statuses present.