Finance tracks cumulative revenue to measure progress toward annual targets. Using the orders table, return month (first day of each month), revenue (that month's total), and cumulative_revenue (running total from the first month), ordered chronologically.
orders
| column | type |
|---|---|
| id | INTEGER |
| customer_id | INTEGER |
| amount | NUMERIC |
| created_at | DATE |
orders
| id | customer_id | amount | created_at |
|---|---|---|---|
| 1 | 1 | 120.00 | 2024-01-05 |
| 2 | 2 | 45.00 | 2024-01-18 |
| 3 | 1 | 300.00 | 2024-02-03 |
| 4 | 3 | 75.00 | 2024-02-20 |
| 5 | 2 | 200.00 | 2024-03-11 |
| 6 | 1 | 50.00 | 2024-03-25 |
| 7 | 4 | 180.00 | 2024-03-30 |
| month | revenue | cumulative_revenue |
|---|---|---|
| 2024-01-01 | 165.00 | 165.00 |
| 2024-02-01 | 375.00 | 540.00 |
| 2024-03-01 | 430.00 | 970.00 |
January: 120 + 45 = 165. February: 300 + 75 = 375 (cumulative 540). March: 200 + 50 + 180 = 430 (cumulative 970).