declare @tmpTbl table(d int primary key, c int, cr int) insert into @tmpTbl select MONTH(<datecol>), ,count(userid),0 FROM <table_name> WHERE group by MONTH(<datecol>) order by MONTH(<datecol>) desc declare @rt int = 0 declare @anchor int update @tmpTbl set @rt = cr = @rt + c, @anchor = d option (maxdop 1) select DATENAME(month, DATEADD(month, d-1, CAST('2012-01-01' AS datetime))) as Month, c as 'current cont', cr as 'accumulative count' from @tmpTbl order by d