New accounts per day (moving average)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

WITH accountsByDate AS (
    SELECT      CAST(u.LastAccessDate AS DATE) as [Date],
                COUNT(*) as numUsers
    FROM        Users u
    GROUP BY    CAST(u.LastAccessDate AS DATE)
)
SELECT
    a.[Date],
    AVG(a.numUsers) OVER (
        ORDER BY a.[Date]
        ROWS BETWEEN ##MovingAvg:int?20## PRECEDING AND CURRENT ROW
    )
FROM accountsByDate a

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results