Mega Search
23.2 Million


Sign Up

Make a donation  
Calculated Members - Crossjoin?  
News Group: microsoft.public.sqlserver.olap

I am adding a calculated member to a cube where I want to aggregate differences between measures from a number of last periods against a measure for the current period:

Simplified I am using this:

SCOPE  ([Measures].[Fact3]);
THIS =
   Aggregate( LastPeriods(3,[Period].CurrentMember),
([Measures].[Fact1]-([Period].CurrentMember,[Measures].[Fact2]))
);

END SCOPE;

But this returns:

(Period1 Fact1 - Period1 Fact2) + (Period2 Fact1 - Period2 Fact2) + (Period3 Fact1 - Period3 Fact2)

But I want:

(Period1 Fact1 - Period3 Fact2) + (Period2 Fact1 - Period3 Fact2) + (Period3 Fact1 - Period3 Fact2)

Any help appreciated.

Thanks

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 2-Aug-2012, at 5:02 AM EST
From: k
 
Re: Calculated Members - Crossjoin?  
News Group: microsoft.public.sqlserver.olap
Just to add that I will be extending this to aggregate the Squares/cubes of the differences and other calulcation so it is not just a case of reordering the simple math to Sum(last periods, Fact1) - 3*(CurrentMember,Fact2)

Thanks

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 2-Aug-2012, at 5:12 AM EST
From: k