Rolling Moving Average (12 months)

  • Hi Experts,

    I am trying to get the moving average for the past 12 months in a simple fact table. (i.e. July 2010 => averages of past 11 months + current month)

    I have a period column (200912, 201001, 201002, 201003, etc) and a value coumn containing figures.

    200912 / 10

    200912 / 12

    200912 / 13

    201001 / 12

    .

    .

    .

    etc

    End results that I want to achieve is like this

    period / Sales / Moving_average

    200912 / 120 / 118

    201001 / 150 / 140

    201002 / 200 / 150

    etc

    could you please help,.

    thanks alot

    James

  • Please click the link in my signature to present your question in more helpfull way.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Please see the following article on this site:

    Calculating Moving Averages with T-SQL[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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