For reference, here is the full SQL for the query:
DECLARE @StartDate datetime = ##StartDate:string##;
DECLARE @EndDate datetime = ##EndDate:string##;
CREATE TABLE #temp (bucket datetime, average float, std float)
INSERT INTO #temp
SELECT
dateadd(hour, datediff(hour, 0, creationdate), 0),
avg(viewcount),
stdev(viewcount)
FROM posts
WHERE posttypeid = 1
AND creationdate BETWEEN @StartDate AND @EndDate
GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)
SELECT
dateadd(hour, datediff(hour, 0, creationdate), 0) AS 'Bucket',
avg(viewcount) AS 'Average view count',
count(*) AS 'Number of questions'
FROM posts INNER JOIN #temp
ON dateadd(hour, datediff(hour, 0, creationdate), 0) = bucket
WHERE posttypeid = 1
AND creationdate BETWEEN @StartDate AND @EndDate
AND viewcount BETWEEN average - 2 * std AND average + 2 * std
GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)