Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Total revenue for multiple periods
Calculating deltas
Creating "revenue in quarters" reports
16. Creating a "revenue in quarters" report – exercise
Summary

Instruction

Great job! It's now your turn to create a "revenue in quarters" report!

Exercise

Create a "revenue in quarters" report showing the number of orders placed in each quarter of each year. The final report should look like this:

Year Q1 Q2 Q3 Q4
2016 0 0 70 82
2017 92 93 103 120
2018 182 88 0 0

Order the rows by year.

Stuck? Here's a hint!

Calculate the first column like this:

DATEPART(Year, OrderDate) AS Year

Remember to group by the first column. All the other columns should be calculated using the following pattern:

COUNT(CASE WHEN DATEPART(Quarter, OrderDate) = X THEN Amount END) AS QX