Neobank Operating Balance
Neobank Operating Balance
You are a treasury analyst at a mobile neobank. The finance team is reviewing how the operating cash position changed during a control period. ledger_entries stores individual credits and debits, while report_days defines every date that must appear in the report. Management needs both each day's net movement and the balance accumulated since the start of the period.
For every date in report_days, calculate the net movement: a credit increases the amount and a debit decreases it. Ignore entries outside the reporting calendar. The balance immediately before the first report date is 0.00.
Return these columns:
- report_date — reporting date in YYYY-MM-DD format;
- daily_net_usd — net movement for the date in USD, numeric with 2 decimal places;
- running_balance_usd — cumulative balance from the first report date through the current date, inclusive, numeric with 2 decimal places.
Return exactly one row for every date in report_days. Sort by report_date ascending. A NULL amount_usd contributes nothing; when a date has no entry with a known amount, daily_net_usd must be 0.00. Count every separate entry on the same date even when amounts are equal; the final output must contain no duplicate dates.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables. Your answer must use the same column names as this sample — alias them with AS if needed.
| report_date | daily_net_usd | running_balance_usd |
|---|---|---|
| 2026-04-01 | 1120 | 1120 |
| 2026-04-02 | -91 | 1029 |
| 2026-04-03 | 300 | 1329 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in