The analytics team wants to track how genre popularity changes over time. Calculate the year-over-year revenue change and growth percentage for key genres.
| Column | Type |
|---|---|
| InvoiceId | INTEGER (Primary Key) |
| CustomerId | INTEGER (Foreign Key → Customer.CustomerId) |
| InvoiceDate | TIMESTAMP |
| BillingAddress | TEXT |
| BillingCity | TEXT |
| BillingState | TEXT |
| BillingCountry | TEXT |
| BillingPostalCode | TEXT |
| Total | NUMERIC(10,2) |
| Column | Type |
|---|---|
| GenreId | INTEGER (Primary Key) |
| Name | TEXT |
LAG() partitioned by genre to get previous year's revenueYoYGrowth percentage (NULL for first year)Ready 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.