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. |