#785

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.

nmonth
62024-01-01T00:00:00.000Z
42024-02-01T00:00:00.000Z
32024-03-01T00:00:00.000Z

Your query result will appear here