Here is an MDX query for the Foodmart Sales cube, which produces similar
results (only last month and last 2 month shown for brevity). Note that
filtering for customers with > $0 in the last 12 months really slows
down the query. Not sure why it's needed, since they must have activity
anyway in the past month/2 months/3 months:
Quote:
|
With Set [LastMonthSet] as
|
'{ClosingPeriod([Time].[Month],[Time].[1997])}'
Set [Last2MonthSet] as 'LastPeriods(2,[LastMonthSet].Item(0))'
member [Measures].[LastMonth] as
'NonEmptyCrossJoin(Filter([Customers].[Name].Members,
Sum(LastPeriods(12,[LastMonthSet].Item(0)),
([Measures].[Store Sales],[Product].CurrentMember)) > 0),
[LastMonthSet],{[Product].CurrentMember},1).Count'
member [Measures].[Last2Months] as
'NonEmptyCrossJoin(Filter([Customers].[Name].Members,
Sum(LastPeriods(12,[LastMonthSet].Item(0)),
([Measures].[Store Sales],[Product].CurrentMember)) > 0),
[Last2MonthSet],{[Product].CurrentMember},1).Count'
Select [Product].[All Products].[Drink].[Beverages].Children on Columns,
{[Measures].[LastMonth], [Measures].[Last2Months]} on Rows
From Sales
- Deepak
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!