I have query (below) that show me data in the column "Monthly".
but I need to rewrite this query to cumulative sums as shows third column on picture. How can I do it? Thanks for any reply.
My current query:
select cast( ( Prodej.Ce_Jedn * Prodej.Mnoz ) / 1000 as numeric(15,2) ) as "Monthly" ,
YEAR( FAV.vatDate ) as "Rok" ,
month( FAV.VatDate ) as "Měsíc"
from Prodej
join FAKTVYDA FAV on FAV.Ci = PRODEJ.C_Fak
and FAV.Rada = PRODEJ.R_Fak
where YEAR(FAV.VATDate) > year(getdate())-3
and FAV.Rada in ('10','20','30','60')
and PRODEJ.C_Fak <> 0
and '@{Stredisko.ParameterValue}' = case Prodej.Str
when '' then FAV.Str
when '-' then FAV.Str
else Prodej.str
end
order by month(FAV.VatDate)