dbTalk Databases Forums  

Joining dimensions

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


Discuss Joining dimensions in the microsoft.public.sqlserver.olap forum.



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

Default Joining dimensions - 11-03-2003 , 12:36 AM






I have a fact table called "Profile" with 6 Yes/No properties. The fact table has a foreign key to an "Organization" table, and that table has a self-referencing parent-child relationship (OrganizationID, ParentOrganizationID). The foreign key value points to the lowest level of the "Organization" table.

Profile
---------
@ProfileID
OrganizationID
Property1
Property2
Property3
Property4
Property5
Property6

Organization
-------------------
@OrganizationID
ParentOrganizationID

Given a particular ParentOrganizationID key, I would like to display the child organizations, and for each child organization I want to count how many of the "Profile" properties are set to "Yes". The count must be aggregated up the organizational tree to the current organizational level. So my pseudo-MDX might look like this:

WITH MEMBER [Measures].[Count] AS
'Count(Filter(Descendants([Organization].CurrentMember, 50, LEAVES),
[Property1].[YesNo] = "Y" And [Property2].[YesNo] = "Y" And [Property3].[YesNo] = "Y"))
'SELECT
{
[Measures].[Count]
} ON COLUMNS,
{
[Organization].&[1].Children } ON ROWS

Is this the most efficient way to execute this query?

Thanks in advance.

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.