• Since the number of days in a week is not likely to change, you can then write a "SELECT AVG(x) GROUP BY y" type of cross-tab query.

    Further reading: http://www.sqlservercentral.com/articles/T-SQL/63681/[/url]

    Example:

    SELECTc.week_of_year as WeekNumber,

    AVG(CASE WHEN c.day_of_week_label = 'Sunday' then ct.CCDATA ELSE NULL END) as AverageOfSunday,

    ...

    FROM calendar c

    JOIN cc_table ct ON dateadd(d, datediff(d, 0, ct.CCDATAcompletedTime), 0) = c.date_key

    GROUP BY c.week_of_year