I have this query in SQL:
select cast(faturas.datatotal as date) as Dia, faturas.sumF, credito.sumC, isnull(sumF,0)-isnull(sumC,0) as Total
from
(SELECT SUM([Line Amount]) as sumF, [Posting Date] as datatotal
FROM [CMW$Sales Invoice Line]
where [CMW$Sales Invoice Line].[Posting Date] >= '2017-01-01'
group by [CMW$Sales Invoice Line].[Posting Date]) faturas
full outer join
(SELECT SUM(Amount) as sumC, [Posting Date]
FROM [CMW$Sales Cr_Memo Line]
where [CMW$Sales Cr_Memo Line].[Posting Date] >= '2017-01-01'
group by [CMW$Sales Cr_Memo Line].[Posting Date]) credito
on faturas.datatotal=credito.[Posting Date]
I need to calculate the cumulative "Total" in this same query. How can I get this?