Question

Using the Adventure works Cube, if I run the following code (from MS example):

with 
Member [Measures].[Internet Sales Amount - Range]
AS aggregate ( [Date].[Fiscal].[Date].&[20080430]:[Date].[Fiscal].[Date].&[20080502] , [Measures].[Internet Sales Amount] )

SELECT
{ [Measures].[Internet Sales Amount - Range] } ON COLUMNS,
{ [Product].[Category].Members } ON ROWS
FROM
[Adventure Works]

You get the proper results.

However, when I implement similar functionality via the SCOPE command in a calculated tab:

scope ([Product].[Category], [Measures].[Internet Sales Amount]);

    this = aggregate ( [Date].[Fiscal].[Date].&[20080430]:[Date].[Fiscal].[Date].&[20080502] , [Measures].[Internet Sales Amount] );

end scope;

and then run the following mdx query:

SELECT
{ [Measures].[Internet Sales Amount] } ON COLUMNS,
{ [Product].[Category].Members } ON ROWS
FROM
[Adventure Works]

I get vastly different results. The scope appears to be ignoring the date range or ignoring the category members, i'm not sure what. I am having a similar issue on my cube when creating a new scope with a date range.

Anyone know what's going on with the scope?

Was it helpful?

Solution

Use

CREATE MEMBER CurrentCube.[Measures].[Internet Sales Amount - Range2] AS NULL;

scope ([Measures].[Internet Sales Amount - Range2]);
    this = aggregate ( [Date].[Fiscal].[Date].&[20080430]:[Date].[Fiscal].[Date].&[20080502] , [Measures].[Internet Sales Amount] );
end scope;

Otherwise, there might be an infinite recursion as you reference the measure inside the scope which you use in the SCOPE itself as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top