New accounts per day (moving average)

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

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 main site
loading Hold tight while we fetch your results