Posted: 4/16/2012
how i can calculate cumulative formula in sql
i dont know formula,
any idea?
Posted: 4/17/2012
hi ssrsrnew. in reporting services you have functions that do that for you.
in t-sql you can either do:
select t1.*, (select sum(amount) from table t2 where t2.modelnum=t1.modelnum and t2.month<=t1.month) [cumulative amount] from table t1 order by t1.name
select a.manufaturer,a.modelnum,a.month,sum(b.amount) as cumulative_sum from table a left join table b on a.modelnum=b.modelnum where a.month>=b.month group by a.manufaturer,a.modelnum,a.month