Month-by-month plus a «year total» row
The reporting team wants «event counts per month plus a «total for the period» row». A classic case of enriching a grouping with an interim total. Group events by their creation month and simultaneously compute the «grand total» level — the last row of the output should have an empty month and the overall event count across every month. Sort by month, with the empty-month total row going last.
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.
| n | month |
|---|---|
| 6 | 2024-01-01T00:00:00.000Z |
| 4 | 2024-02-01T00:00:00.000Z |
| 3 | 2024-03-01T00:00:00.000Z |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in