#811

Trailing 7 days: see the last week from every day

Weekly financial report: for every day we need the sum of revenue over the last seven days inclusive (this day plus the previous six). This view is often called «trailing 7-day». For every day compute that rolling sum. For the first six days the window is physically smaller than seven — that's fine, the result is still valid (just the sum of whatever is there). Sort by day.

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.

dsum_7d
2024-01-01100.00
2024-01-02220.00
2024-01-03330.00

Your query result will appear here