Produce a monthly report combining MoM revenue growth with the top-spending customer in that month.
| Column | Type |
|---|---|
| CustomerId | INTEGER (PK) |
| FirstName | TEXT NOT NULL |
| LastName | TEXT NOT NULL |
| Company | TEXT |
| Country | TEXT |
| TEXT NOT NULL | |
| SupportRepId | INTEGER (FK → Employee) |
| Column | Type |
|---|---|
| InvoiceId | INTEGER (PK) |
| CustomerId | INTEGER (FK) |
| InvoiceDate | TIMESTAMP NOT NULL |
| BillingCountry | TEXT |
| Total | NUMERIC(10,2) NOT NULL |
YYYY-MMPreviousRevenue via LAG(), and MoM_Growth_Pct (rounded to 2 decimals, NULL for the first month)ROW_NUMBER() OVER (PARTITION BY month ORDER BY customer_spend DESC)Month, MonthlyRevenue, PreviousRevenue, MoM_Growth_Pct, TopCustomer (FirstName + space + LastName), TopCustomerSpendReady to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.
Run your code to see the result here.