Good job! The last thing we'll show you in this part is how to do revenue reports for the current year, month, etc. They're another frequent financial report, and they show how much the company earned so far in the given current period. Commonly used report types are:
- year-to-date (YTD) – refers to the period beginning the first day of the current calendar year up to the current date.
- month-to-date (MTD) – refers to the period of time between the 1st of the current month and the current date.
- quarter-to-date (QTD) – refers to the period of time between the beginning of the current quarter and the current date.
YTD, MTD, and QTD reports are used by business owners, investors, and individuals to analyze their revenue, income, business earnings, and investment returns for the current period of time.
For example, if we want to show the month-to-date revenue:
SUM(Amount) AS TotalRevenue
FROM Orders O
JOIN Customers C
ON O.CustomerId = C.CustomerId
WHERE OrderDate >= DATEADD(Month, DATEDIFF(Month, 0, GETDATE()), 0)
GROUP BY C.CustomerId,
If you look at the
WHERE clause, you can see we used the technique we learned in the previous exercise to compute the beginning of the current month.