Q&A for people looking to bypass life's everyday problems with simple tricks
DECLARE @UserId int = ##UserId## -- Enter Query Title -- Enter Query Description select x, y, lag(y,1) over (order by x) z from ( select dateadd(mm,datediff(mm, 0, CreationDate),0) as x, count(1) as y from Users group by dateadd(mm,datediff(mm, 0, CreationDate),0) ) as w ; /*select top 200 dateadd(mm,datediff(mm, 0, CreationDate),0),CreationDate from Users;*/