• With no data or test script to work with, my guess would be that this part of the query

    nashpats (7/22/2016)


    (

    SELECT SUM(amount)

    FROM dbo.vw_LT T2

    WHERE T2.LinkID <= T1.LinkID

    )Cumulative

    Needs to be filtered in the same way as the main part of the query, so should read

    (

    SELECT SUM(amount)

    FROM dbo.vw_LT T2

    WHERE T2.LinkID <= T1.LinkID

    AND t1.accnumber ='8400000'

    AND t1.DDate BETWEEN '2016-04-01 00:00:00' AND '2016-04-30 00:00:00'

    AND t1.DataSource = 'PAS11CEDCRE17'

    )Cumulative