• To add to SQLCJ's post, you will need to include the ORDER BY date_value at the end to get the OP's expected result - and some ugly string manipulation for the date

    SELECT CONVERT(CHAR(4), GETDATE(), 120) + ' ' + CONVERT(CHAR(4), GETDATE(), 100) ,

    monthly_total ,

    ( SELECT SUM(monthly_total)

    FROM #sales s

    WHERE date_value <= tst.date_value

    ) AS monthly_total

    FROM ( SELECT * ,

    ROW_NUMBER() OVER ( ORDER BY date_value ) tst

    FROM #sales

    ) tst

    ORDER BY date_value A

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience