Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Reports with revenue in categories
Revenue in time periods for selected categories
Summary

Instruction

Good job! Let's try another exercise before we move on.

Exercise

For each month of 2017, calculate the total revenue, and the revenue for the 'Dairy Products' and 'Seafood' categories. Show the following columns: RevenueMonth, TotalRevenue, DairyRevenue, and SeafoodRevenue. Order the results by month.

Stuck? Here's a hint!

Group the results by DATEPART(Month, OrderDate).

Calculate the DairyRevenue column as:

SUM(CASE
  WHEN C.CategoryName = 'Dairy Products'
     THEN OI.Amount
  ELSE 0.0
END) AS DairyRevenue