Here's an example for Adventure Works - but 2 is subtracted from the
Year, to shift to valid months (in 2004). Note that the Month attribute
has 2 key columns of Year and Month Number, which are used to select the
appropriate month:
Member [Measures].[ThisMonth] as
"[Date].[Calendar].[Month].&["
+ CStr(Year(Now())-2)+ "]&["
+ CStr(Month(Now())) + "]"
Set [Last12Months] as
LastPeriods(12,
StrToMember([Measures].[ThisMonth]).PrevMember)
select {[Measures].[Order Quantity]} on 0,
[Last12Months] on 1
from [Adventure Works]
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.developersdex.com ***