Plot the site activity by voting, questions, answers and comments, aggregated per week.
Q&A for professional and enthusiast programmers
with Voting as (
select DATEADD(DAY, 7 - DATEPART(WEEKDAY, v.CreationDate), v.CreationDate) as YearMon,
case when p.PostTypeId = 1 then 'Q' else 'A' end + vt.Name as Series,
1 as Vote
from Posts p,
where p.Id = v.PostId
and v.VoteTypeId = vt.Id
for Series in ([QUpMod],[QDownMod],[QFavorite],[AUpMod],[ADownMod],[AAcceptedByOriginator]))
where YearMon >= DATEADD(WEEK, -60, CURRENT_TIMESTAMP) -- previous 60 weeks.
and YearMon < CURRENT_TIMESTAMP -- ignore most recent week.
order by YearMon