Sunday, March 11, 2012

AS2005: Building a parent-child hierarchy on a table that also includes a surrogate key

Hi,

Any assistance with this will be most useful as I'm struggling to find a difinitive answer anywhere.

I have a table that includes a Surrogate Key column (primary key), a Child ID column, a Parent ID column and a Description column.

When building a parent-child dimension through the Analysis Services 2005 wizard the first decision comes on the 'Select the Main Dimension Table' screen. The Surrogate Key has to be selected as the 'Key Column' (for the relationship to the Fact Table) and the Description column is selected for the 'Column containing the member name (optional)'.

The next screen is 'Select Dimension Attributes' - do I select Child ID, Parent ID or both? And do I need to make any changes to the 'Attribute Key Column' and 'Attribute Name Column' fields in here (I cannot see why you would need to)?

Finally, the 'Define Parent-Child Relationship' screen highlights the issues around selecting the Surrogate Key as the 'Key Column' previously. Even though the DSV has the relationship between Child ID and Parent ID clearly defined, the dimension wizard attempts to build a parent-child hierarchy using the Surrogate Key and Parent ID.

I have tried building this dimension using the Child ID as the 'Key Column' instead and the structure seemed to turn out okay. However, as there is no relationship between Child ID and the Fact Table this arrangement meant that the cube process resulted in no data being displayed.

If anyone can please shed light on this frustrating issue I will be very grateful.

Thanks,

Stu

Some earlier posts in this forum have discussed similar parent-child scenarios. One solution which should work, but may increase cube processing time, is to substitute a Named Query for the fact table. This Named Query would join the fact and dimension tables on the Surrogate Key, so that the Child ID gets added as a field to the resultant fact table. Then the dimension can be built from another Named Query on the dimension table, which eliminates the Surrogate Key. The Child ID could now be the key column, which you said worked OK.|||

Thanks Deepak.

I'm aware that there are several work arounds but very surprised that this cannot just be resolved within Analysis Services (excluding the use of named queries in the DSV).

Regards,

Stuart

No comments:

Post a Comment