Search code examples
mdx

Trying to get a four weekly running forecast of our average m3 sold


image

I would like to get a running average m3 over the last four weeks of sales.

so far I have come up with the following MDX query but it doesn't seem to work

Avg
([Normal Calendar].[Calendar Hierarchy].[Cal Week].Lag(4) :
[Normal Calendar].[Calendar Hierarchy].[Cal Week],
[Measures].[Intake Ordered m3]
)

Solution

  • I think just using the CURRENTMEMBER function could help:

    AVG
    (
       [Normal Calendar].[Calendar Hierarchy].CURRENTMEMBER.Lag(4) :
       [Normal Calendar].[Calendar Hierarchy].CURRENTMEMBER
      ,[Measures].[Intake Ordered m3]
    )
    

    or maybe this:

    AVG
    (
       [Normal Calendar].[Calendar Hierarchy].[Cal Week].CURRENTMEMBER.Lag(4) :
       [Normal Calendar].[Calendar Hierarchy].[Cal Week].CURRENTMEMBER
      ,[Measures].[Intake Ordered m3]
    )