dbTalk Databases Forums  

Problem with scope and muliple hierarchies

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Problem with scope and muliple hierarchies in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jensi
 
Posts: n/a

Default Problem with scope and muliple hierarchies - 08-03-2006 , 10:06 AM






Hi

I have a problem with multiple hierarchies and a certain business
requirement.

I have measure - [MEASURES].[xCountBusinessDays] - based on a column in
my view containing a 0 or 1 depending on whether a certain day is
weekday or not. Then, there is a calculated member that, for all levels
except the date level, simply returns this measure. This works fine,

My problem is that for the date level I want the value for the current
member's parent, as this is used in other calculations to divide sales
figures by the number of business days during a given period. This
period can be any level in either a year-week-date or a
year-quarter-month-date hierarchy.
The calculated member is defined like this:


CREATE MEMBER CURRENTCUBE.[MEASURES].[Count Business Days]
AS [Measures].[xCountBusinessDays],
VISIBLE = 1;

SCOPE [MEASURES].[Count Business Days];


SCOPE ( [Period].[Period Month].[PM - Date].Members);
this = ([Period].[Period Month].CurrentMember.Parent,
[MEASURES].[xCountBusinessDays]);
END SCOPE;


SCOPE ( [Period].[Period Week].[PW - Date].Members);
this = ([Period].[Period Week].CurrentMember.Parent,
[MEASURES].[xCountBusinessDays]);
END SCOPE;

END SCOPE;

My problem is that if I have both hierarchies in the [MEASURES].[Count
Business Days] scope they seem to disturb each other.
If I drill down to the [Period].[Period Month].[PM - Date] level I will
get the value for the week hierarchy: 5. Not 21 like I expected for
July 2006.

If I switch the order of the two defined scopes the opposite will
occur. Drilling down to the [Period].[Period Week].[PW - Date] level
will give me 21 as result, not 5.

Am I missing something here?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.