spróbuj tego, musisz użyć dynamicznego sql
Declare @toyear int=2016
Declare @forcast int=10
Declare @t table (ITEM varchar(50), years int, qty int)
insert into @t
select 'TM-A' ITEM , 2013 years, 100 qty
union all
select 'TM-B' ITEM , 2013 years, 200 qty
;with CTE1 as
(
select * from @t
union all
select b.ITEM,b.years+1,b.qty+((@forcast*b.qty)/100) from @t a
inner join cte1 b on a.ITEM=b.ITEM
and b.years<@toyear
)
select * from
(select * from cte1 )t4
pivot(min(qty) for years in([2013],[2014],[2015],[2016]))pvt