Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3 Months Lag

Status
Not open for further replies.

nsomani1

Programmer
Feb 25, 2008
3
0
0
US
Guys please help

I am trying to calculate a Avg of 3 month lag , which is basically , previous two months , plus number of days in the current month. Apparently i do not get the result set. I feel i might be ignoring something.

The basic scenario of calculation is
3 Months Rolling Avearge 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.

When i use the lag and last period functions, i get the result set which is equivalent to the orignal value.

the calculation i have used so far is as follows.

LastPeriods(3, [Tbl Date Key].[Ke Date].CurrentMember),
[Measures].[Q1_Avg]

as well on the lag

Avg
(
[Time].[Month].CurrentMember.Lag(2) :
[Time].[Month].CurrentMember,
[Measures].[Q1_Avg]
)

But apparently , none of them works, would it be do something with Null.

please advise , am newbie to MDX and trying to place this solution.

Please advise if their is any other code.

Regards

Ns
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top