The DATEFROMPARTS function does not work in the 2008 edition.
As an alternative ...
declare @fromDate date, @toDate date ;
select @fromDate=
dateadd(m,0,cast(Cast(year(getdate())-2 as char(4)) as date))
select @toDate = cast(getdate() as date) ;
Select @fromDate , @todate
Next you can employ these variables in your select statement.
Something like
select
year(orderDate ) as [year],
sum(orderAmount) as totalAmount
from
yourTable
Where
orderDate >=@fromDate and orderDate < @toDate
group by
year(orderDate)
Make sure to make a note somewhere in your report that the latest year value should be interpreted as a year to date, just in case someone is not paying attention.
----------------------------------------------------