T-SQL to Forecast value till the end of the year

  • All,

    Attached is a file that generates a sample dataset from which I want to forecast a value for column 'Parcel Count 2014' from tomorrow (30/10/2014) till the end of December (31/12/2014). The forecast should be based on values from column 'Parcel Count 2013' for the same Month.

    Please help me write this T-SQL.

    Thanks,

    J.

  • This was removed by the editor as SPAM

  • I was hoping to calculate that on the 2013 figures and maybe add a 5% increase for this year,is that possible? the forecast is seasonal and the last quarter retailers are expected to sell more online. Please note that the sample data is about number of parcel bought online.

  • This was removed by the editor as SPAM

  • Thank you but it is not what I want. You have projected all the 2014 values based on the 2013 values. I only want the 2014 projection to start from tomorrow until the end of December. All the values I already have for 2014 (I would normally have till today) comes from the database so they should stay as they are.

  • This was removed by the editor as SPAM

  • This does not work. The calculation is still being applied on all rows for 2014.

  • This was removed by the editor as SPAM

  • I think that will work if set this as a sub query and inner join with the dataset on TheDate.

    Thank you.

  • Here is another alternative..

    select TheDate

    ,TheMonth

    ,WeekName

    ,ParcelCount2013

    ,case when TheDate is not null and TheDate > '2014-10-02' and TheDate < '2015-01-01' then ParcelCount2013 + ((ParcelCount2013 * 5)/100) else ParcelCount2014 end as Parcel_Count_2014

    from d

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply