On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Total revenue for multiple periods
Calculating deltas
Creating "revenue in quarters" reports


Well done! Let's try another exercise.


Calculate the total monthly revenue for each month of 2017, along with the revenue change as compared to the previous month. Show three columns: RevenueMonth, TotalRevenue, and Delta.

In the first row, leave the delta value as NULL. Order the rows by month.

Stuck? Here's a hint!

Use the following expression to calculate the delta:

SUM(Amount) - LAG(SUM(Amount), 1) OVER (ORDER BY DATEPART(Month, OrderDate)) AS Delta