Results 1 to 5 of 5

Thread: 3 Months Lag

  1. #1
    Join Date
    Mar 2008
    Posts
    11

    Unanswered: 3 Months Lag

    I have a question i am confused very much with i am doing on MTD Average , i really need some help with code.

    the logic behind the code is



    3 MTD should be the past two completed months as well as the dates in the current month as well. So taking the example above if the reporting period for Feb was 01/30/2007 to 02/27/2007, and March was 02/28/2007 to 03/27/2007, the 3 MTD should then be the average from 01/30/2007 to 04/10/2007.



    This code does not actually gives me the exact value, please advise on any correction to the code , or a new way to write the code.



    Avg
    (
    [Time].[Month].CurrentMember.Lag(3) :
    [Time].[Month].CurrentMember,
    [Measures].[A1_Avg]
    )

  2. #2
    Join Date
    Jan 2005
    Location
    Atlanta
    Posts
    58
    Could you provide the DDL for the table you are querying?

  3. #3
    Join Date
    Mar 2008
    Posts
    11
    This a cube, where i am trying to create a calculated measure using the above expression, that should derive the average for the days in the current period + previous two months period, as explained above.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This is something of a shot in the dark, but my intuitive guess would be:
    Code:
    Avg
    (
    [Time].[Month].CurrentMember.Lag(2) : 
    [Time].[Month].CurrentMember.Lag(1), 
    [Measures].[A1_Avg]
    )
    Keep in mind that this may be grossly skewed if the measures are atomic.

    -PatP

  5. #5
    Join Date
    Mar 2008
    Posts
    11

    3 Months Lag

    Pat

    It does not display any result, i guess it should be straight forward calculation but for some reason the results or not right ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •