Handy SQL: Counts Across a Date Range

I recently wanted to list a count of occurrences across a data range so that I could render a line graph. I knew that some of the dates would contain 0 occurrences, so I new I'd need to list all dates within the range, and left join to the occurrence-by-date count. With the help of this SO post ( http://stackoverflow.com/a/23291758/3264286 ) I created the following SQL that I think will be pretty useful for similar requirements in the future:

DECLARE @MinDate DATE = (SELECT MIN(Generated) FROM Application.TenYearPropertyPlan),  
        @MaxDate DATE = (SELECT MAX(Generated) FROM Application.TenYearPropertyPlan);

WITH Dates AS (SELECT TOP (DATEDIFF(DAY, @MinDate, @MaxDate) + 1)  
                        Date = DATEADD(DAY, ROW_NUMBER() OVER(ORDER BY a.object_id) - 1, @MinDate)
               FROM    sys.all_objects a CROSS JOIN sys.all_objects b)

SELECT d.[Date], ISNULL(p.[Count], 0) AS NumTyppGenerated  
FROM Dates d LEFT JOIN (SELECT   CONVERT(DATE, Generated) GeneratedDate, Count(1) AS [Count]  
                        FROM     Application.TenYearPropertyPlan
                        GROUP BY CONVERT(DATE, Generated)) AS p ON d.[Date] = p.GeneratedDate
ORDER BY 1;  

Handy SQL: Counts Across a Date Range