All what you need to do is to create query called "running sum", "running totals", etc.
Check these:
Calculating simple running totals in SQL Server[
^]
SQL SERVER - How to Find Running Total in SQL Server - Journey to SQL Authority with Pinal Dave[
^]
Then, you have to pivot data. That's all!
Try:
DECLARE @tmp TABLE(adate DATE, acount INT)
INSERT INTO @tmp(adate, acount)
VALUES('2016-01-01', 1),
('2016-01-02', 1),
('2016-01-03', 2),
('2016-01-04', 1),
('2016-01-05', 3),
('2016-01-06', 4),
('2016-01-07', 2),
('2016-01-08', 5),
('2016-01-09', 1),
('2016-01-10', 2),
('2016-01-11', 2),
('2016-01-12', 1),
('2016-01-13', 3)
SET DATEFIRST 1;
SELECT [1], [2], [3]
FROM (
SELECT a.weekno,
(SELECT SUM(acount) AS runningsum
FROM @tmp AS b
WHERE DATEPART(wk, adate) <= a.weekno) AS RunningSum
FROM (
SELECT adate, acount, DATEPART(wk, adate) AS weekno
FROM @tmp
) AS a
GROUP BY a.weekno
) AS DT
PIVOT (SUM(runningsum) FOR weekno IN ([1], [2], [3])) AS pt
Result:
1 2 3
4 22 28