Question

Jam2811 on Tue, 28 Aug 2007 12:13:17


Isn't it possible to scope both a real measure and a calculated "measure member" ?

I have the folloving

 

Normal Measures:

[MEASURES].[Actual]

[MEASURES].[Budget]

 

And then in calculations i have the following:

 

CREATE MEMBER CURRENTCUBE.[MEASURES].[Actual ytd]

AS Sum(PeriodsToDate([Period].[Month Hierarchy].[Year],[Period].[Month Hierarchy].CurrentMember), ([Measures].[Actual])),

VISIBLE = 1;

CREATE MEMBER CURRENTCUBE.[MEASURES].[Budget ytd]

AS Sum(PeriodsToDate([Period].[Month Hierarchy].[Year],[Period].[Month Hierarchy].CurrentMember), ([Measures].[Budget])),

VISIBLE = 1;

 

Now further down in the calculations i want to use a scope

SCOPE ({[Measures].[Actual],[Measures].[Budget]});

{[Account].[Account].&[30]}

=

(([Account].[Account].&[9]-[Account].[Account].&[25])/[Account].[Account].&[31]);

END SCOPE;

 

This works fine but if i want the 2 calulated meassures to be in the scope as well, how do i do that ?

 

If i use this:

SCOPE ({[Measures].[Actual],[Measures].[Budget],[MEASURES].[Actual ytd],[MEASURES].[Budget ytd]});

 

i'll get the following error:

Error: A set has been encountered that cannot contain calculated members.

 

My only solution at this point is to do the same calculation 3 times - One scope for Actual and budget, one scope for [Actual ytd] and one scope for [budget ytd]. This is kind of irritating if you have to change the calculation for {[Account].[Account].&[30]}

Replies

Christopher Webb on Tue, 28 Aug 2007 13:10:36


I've come across this, and I think it's a problem with the SCOPE statement. If you rewrite your assignment so you don't use SCOPE like so:

 

({[Measures].[Actual],[Measures].[Budget],[MEASURES].[Actual ytd],[MEASURES].[Budget ytd]}, {[Account].[Account].&[30]}) = (([Account].[Account].&[9]-[Account].[Account].&[25])/[Account].[Account].&[31]);

 

Does this now work?

 

Chris

 

 

Jam2811 on Thu, 30 Aug 2007 11:07:35


Yes it worked thanks!!!

 

markf7962 on Wed, 05 Nov 2008 23:39:54


I dont understand how that could possibly have worked as there is still a set 

 

{[Measures].[Actual],[Measures].[Budget],[MEASURES].[Actual ytd],[MEASURES].[Budget ytd]}

 

with calculated members in it.

 

Tomislav Piasevoli on Thu, 06 Nov 2008 10:14:54


 

Hi markf7962,

 

If you read Chris' post carefully, it says this set is not inside a scope, it's a stand-alone command in MDX script. So, no scope and end scope around it. Maybe that's why it worked.

 

Regards,

 

 

Tomislav Piasevoli

Business Intelligence specialist

http://www.softpro.hr

Surya Bose on Wed, 12 Apr 2017 11:27:10


I tried writing a similar scope but get the error as 

MdxScript(Provider) (71, 153) Parser: The syntax for ',' is incorrect

({[Measures].[Dollars],[Measures].[ Allocation Pct]}) = ([Measures].[Dollars]*[Measures].[Allocation Pct]);