Monthly Delinquency Rate by Investor From Loan Snapshots
Last updated: November 29, 2026
Quick Overview
Using a table of month-end loan snapshots, compute for each investor and month the share of active loans that are 30 or more days delinquent, both by loan count and by unpaid principal balance.
Valon
November 29, 20260
0
0 solved
Using a table of month-end loan snapshots, compute for each investor and month the share of active loans that are 30 or more days delinquent, both by loan count and by unpaid principal balance.
Investor reporting is a core output of a servicing platform like ValonOS, and delinquency rate is the first number every investor asks about. The interviewer checks that you define the denominator carefully, weight by balance as well as count, and avoid integer division.
What the Interviewer Expects
- Define active loans for the denominator (exclude paid off and transferred)
- Compute both count-based and UPB-weighted rates
- Use conditional aggregation
- Avoid integer division and divide-by-zero
- Group by investor and month
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you add a 60+ and 90+ bucket in the same query?
- Should loans in forbearance count as delinquent?
- How would you compare this month to the same month last year?
- What indexing or partitioning would make this fast on billions of rows?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table loan_month_snapshot(loan_id, snapshot_month DATE, investor_id, status TEXT, days_past_due INT, upb_cents BIGINT), one row per loan per month-end. status is one of 'active', 'paid_off', 'tran...
Approach
Filter to active loans, group by investor and month, and use SUM(CASE ...) to count delinquent loans and their balance. Cast to numeric before dividing and wrap the denominator with NULLIF so an i...