Showing posts with label dimension. Show all posts
Showing posts with label dimension. Show all posts

Monday, March 26, 2012

Parent-child hierarchy & fact data?

I'm new to SSAS & would really appreciate any help!

we have an Employee dimension that contains oranizational structure & has parent-child relationship (employee_id as primary surrogate key & parent_id self referencing employee_id) as Employees hierarchy.

there's a number of linked fact tables that link back to dimEmployee.

here's the problem - when I use MS excel & pivot table & link employee id or name or any attributte of the dimEmployee to my fact tables everything is good, but when I use Employees hierarchy (so that it displays the tree on the left etc) then the linking isn't happening & instead I see only global total for each line.

how can I fix this?!

Thanks!

I'd like to know it too...

I had similar case where I had to add additional column for an operator (+/-) & use accounting intelligence & it did the trick for me.

Parent-child dimension related to fact table

is it possible to use a "regular relation" to connect fact table to a
parent-child dimension?
thanksOoops! I'm using Analysis Services 2005 :-)

Parent-Child Dimension in a Report

Hi,
I saw some threads about using parent-child dimensions in a reporting
services report on an OLAP cube in this newsgroup. I have the same problem
that I didn't get the nesting, I want, because reporting services didn't
render it. I tried with the UniqueName and ParentUniqueName properties, but
I only get a hierarchy of Level2 and no deeper. Does anyone knows a solution
in the meantime?
Thanks
HansI have managed to get round this problem by creating a virtual
dimension of level 3 and then doing a cross join on the 2 dimensions.
This will get you your nesting

Parent-child dimension and show empty lines option

I have an issue with a parent-child dimension and ability to show empty lines in browser/client.

Example:

We are putting a parent-child dimension on rows in browser/excel based client and any measures in the data section.

By default the dimension is filtered and only shows dimension members with at least one non-empty measure. However, in certain cases we need to see all dimension members, even when the measures are empty.

To achieve this, there is an option to show empty lines (in cube browser as well as in client we are using for ad hoc data access).

There is however a problem with this option, but only if we use parent-child dimension and we go below first level. Every subsequent level shows all the dimension members and the parent dimension member.

I'll try to illustrate:

before enabling show empty lines:

Lvl1 Lvl2 Measures

A A-A X

A A-B X

A A-C X

B B-A X

B B-C X

After enabling:

Lvl1 Lvl2 Measures

A A X

A A-A X

A A-B X

A A-C X

A A-D

B B

B B-A X

B B-B

B B-C X

In our case this means that every listing of sub-categories withing a category in our product hierarchy, shows all sub-categories and a parent category.

This basically destroys the reporting layout we used since AS2000 and so far I did not find anything that would allow me to change this behavior or anything that would make me believe this is planned behavior in AS2005.

Any help is appreciated

Try setting the nonleafdatahidden property on the parent attribute.

Parent-child dimension

I'm trying to connect a parent-child dimension to my fact table.
I would like to browse cube measure (sold items quantity) through the
dimension "Groups" representing items family (tree structure).
Here are the tables:
Fact table (items sold with quantity):
--
IdItem;Quantity
1;5
2;2
3;1
1;6
3;8
--
Dimension table (parent-child tree representing groups item):
--
IdGroup;GroupName;IdParent;IdItem
1;AAA;-1;-1
2;BBB;1;-1
3;CCC;1;-1
4;O1;2;1
5;O2;2;2
6;O3;3;3
--
If I connect dimension to fact table with a regular relation (on IdItem
attribute of each table) and browse cube, I obtain for each node the
same quantity (22)
AAA (22)
-BBB (22)
--O1 (22)
--O2 (22)
-CCC (22)
--O3 (22)
I would like to obtain this result:
AAA (22)
-BBB (13)
--O1 (11)
--O2 (2)
-CCC (9)
--O3 (9)
If I use a "reference relation" with a middle table it's ok...
but I don't understand the difference!!!!!!
Can someone help me?
thanksOoops! I'm using Analysis Services 2005 :-)

> I'm trying to connect a parent-child dimension to my fact table.
> I would like to browse cube measure (sold items quantity) through the
> dimension "Groups" representing items family (tree structure).
> Here are the tables:
> Fact table (items sold with quantity):
> --
> IdItem;Quantity
> 1;5
> 2;2
> 3;1
> 1;6
> 3;8
> --
> Dimension table (parent-child tree representing groups item):
> --
> IdGroup;GroupName;IdParent;IdItem
> 1;AAA;-1;-1
> 2;BBB;1;-1
> 3;CCC;1;-1
> 4;O1;2;1
> 5;O2;2;2
> 6;O3;3;3
> --
> If I connect dimension to fact table with a regular relation (on IdItem
> attribute of each table) and browse cube, I obtain for each node the
> same quantity (22)
> AAA (22)
> -BBB (22)
> --O1 (22)
> --O2 (22)
> -CCC (22)
> --O3 (22)
> I would like to obtain this result:
> AAA (22)
> -BBB (13)
> --O1 (11)
> --O2 (2)
> -CCC (9)
> --O3 (9)
> If I use a "reference relation" with a middle table it's ok...
> but I don't understand the difference!!!!!!
> Can someone help me?
> thanks

Parent ID in a Slowly Changing Dimension

Hi There,

Just wondering if any of you implemented a (Kimball type 2) dimension structure, in which a ParentID column exists which points to a record from the same dimension table, using a SCD objects in SSIS. The ParentID column would have to be "Historical".

The challange here is that you would need to go through the table twice somehow, because if I would do a lookup of the parent record in the first run, I wouldn't be sure if I got the right parent record.

Thnx, Jeroen.

Jeroen Alblas wrote:

Hi There,

Just wondering if any of you implemented a (Kimball type 2) dimension structure, in which a ParentID column exists which points to a record from the same dimension table, using a SCD objects in SSIS. The ParentID column would have to be "Historical".

The challange here is that you would need to go through the table twice somehow, because if I would do a lookup of the parent record in the first run, I wouldn't be sure if I got the right parent record.

Thnx, Jeroen.

I don't understand the problem or question. I think if you define ParentID as 'historical' the SCD component will issue a new 'version' of the rows every time it detects a change in parentID value and it will 'expire' the previous 'version'. It’s just simple like that. It may be helpful is you provide an example of what you are trying to accomplish

|||

Why would your Id column change if you have a type2 change?

Are you using a typ2 column to lookup your parentID?

|||

Okay, let me try to give an example:

Lets say we have an employee named Doopie and his boss named Barkie, both in the dim_Employee table. In our case we work with start- and enddates.

ID Name ParentID Salary Stardate EndDate
10 Doopie 20 1000 1/1/1900 12/31/9999
20 Barkie NULL 4000 1/1/1900 12/31/9999

Okay, now, in the source system, Barkie gives himself a raise of 500. We want to track history of Salary. Now say we start the Data flow task with the Slowly changing dimension object. It could very well be, that Doopie's record is processed first. No changes there so Doopie's record remains unchanged. Now Barkie record which introduces a new row:

ID Name ParentID Salary Stardate EndDate
10 Doopie 20 1000 1/1/1900 31/12/9999
20 Barkie NULL 4000 1/1/1900 12/7/2006
21 Barkie NULL 4500 12/8/2006 31/12/9999

If Doopie's record was processed after the insert of Barkie's record, the lookup would return record 21 as the active Boss record, and introduce a new record for Doopie as well...

Thnx again!
Jeroen

|||

I see the problem now. Basically you need to make sure every child record point to the latest version of its parent.

Well, I don't see an easy way to do this at one pass. You may try to do an update after the dataflow with the SCD2 finish that assures every row is pointing to the latest version row of its parent. That could be safer in the case that an unchanged child row is not in your set of rows to be processed (assuming you are pulling only changed/new rows from the source). That is my best shot considering that I have not drunk my first coffee this morning

|||Why don't you normalize that table?|||

Phil wrote:

Why don't you normalize that table?

Hi Phil, I normalized some columns of it (name of parent), but the parent / child hierarchy goes about six or seven levels. So then I would have to add quite a few columns...

Rafael wrote:

You may try to do an update after the dataflow with the SCD2 finish that assures every row is pointing to the latest version row of its parent.

I can't just do an update, because the ParentID is defined as type 2 (historical) and should result in a new row for the child record as well...

Jeroen

|||

Jeroen Alblas wrote:

I can't just do an update, because the ParentID is defined as type 2 (historical) and should result in a new row for the child record as well...

So let's define 'historical'. Defining a column as 'historical' to me is intended to track changes on a particular attribute. In the example you gave at the beginning you said that no changes were made to the child row:

“No changes there so Doopie's record remains unchanged.”

So, why do you want to issue a new version of the child row? The only change that occurred was to the parent; hence you should generate a new row to the parent, expire the existing (parent)one and update all its children to point to new parent ID. After all, there is not change to track when you look at the child record.

In your example, I would issue a new row for Doopie only if I detected that Barkie is not anymore his manager; that way I would be tracking historical changes of the managers.

Under your approach, have you figured out what would happened if a change occurs to the topmost manager? You would have to generate a new row for the whole organization…kind of messy to me. BTW, the only way I see you could implement this is through recursive queries…if you are using SQL Server 2005 you could use Common table expressions for that.

|||

Indeed no changes are made to the attributes of the child record, unless you consider the ParentID column an attribute of the child record. And updating it will solve it for the current point in time, but as you can see in the example, yit would seem Doopie's parent would always have had a salary of 4500...

But I agree; if the topmost record would change I would get the whole tree inserted again ... Indeed that's not what I want.

So, I guess I will add the parent columns which must lead to a new child record (Firstname, Lastname, Login, etc) to the child record and update the ParentID to point to the active record of the parent.

Still, I think I must conclude that the dimensional modelling technique, at least to my knowledge, does not provide a good method of combining "tracking history" in combination with "recursive relationships".

Thnx, Jeroen

|||

The way I usually handle this is by using a business Key to uniquely identify each person (see EmployeeID)
If you have a single source for your employees, you can use that id, otherwise you have to generate one. Then, you
use this key for the relationship like so

ID EmployeeID Name ParentID Salary Stardate EndDate
10 100 Doopie 200 1000 1/1/1900 12/31/9999
20 200 Barkie NULL 4000 1/1/1900 12/31/9999

After the change the data would look like this:

ID EmployeeID Name ParentID Salary Stardate EndDate
10 100 Doopie 200 1000 1/1/1900 31/12/9999
20 200 Barkie NULL 4000 1/1/1900 12/7/2006
21 200 Barkie NULL 4500 12/8/2006 31/12/9999

|||

Jeroen Alblas wrote:

Indeed no changes are made to the attributes of the child record, unless you consider the ParentID column an attribute of the child record.

Indeed, I would not consider it an attribute of the child row.

Jeroen Alblas wrote:

And updating it will solve it for the current point in time, but as you can see in the example, yit would seem Doopie's parent would always have had a salary of 4500...

I disagree. It does not seem like Doopie's parent always have had a salary of 4500; what it actually seems is the current salary of her parent is 4500. You should not try to get historical information of a row through its children...I gues that should be part of educating end users on what a SCD 2 is and what is not.

Jeroen Alblas wrote:

But I agree; if the topmost record would change I would get the whole tree inserted again ... Indeed that's not what I want.

That is certanly not practical...

Jeroen Alblas wrote:

So, I guess I will add the parent columns which must lead to a new child record (Firstname, Lastname, Login, etc) to the child record and update the ParentID to point to the active record of the parent.

That was pretty much my original sugestion...good luck with that

|||

David Frommer wrote:

The way I usually handle this is by using a business Key to uniquely identify each person (see EmployeeID)

Thnx David. I do have the business key of the employee in the dimension. However, if you create a parent-child dimension in Analysis Services, you need a key which identifies a unique row in the dimension table. I didn't mention this before, but this is one of the things for which I use the column.

Jeroen

|||

Rafael Salas wrote:

You should not try to get historical information of a row through its children...I gues that should be part of educating end users on what a SCD 2 is and what is not.

Although I'm still convinced the ParentID is not quite as useful if it doesn't give the same result as joining using the business key in combination with start- and enddate, I think this a quite a good conclusion to wrap this up :) thnx.

Jeroen

Parent ID in a Slowly Changing Dimension

Hi There,

Just wondering if any of you implemented a (Kimball type 2) dimension structure, in which a ParentID column exists which points to a record from the same dimension table, using a SCD objects in SSIS. The ParentID column would have to be "Historical".

The challange here is that you would need to go through the table twice somehow, because if I would do a lookup of the parent record in the first run, I wouldn't be sure if I got the right parent record.

Thnx, Jeroen.

Jeroen Alblas wrote:

Hi There,

Just wondering if any of you implemented a (Kimball type 2) dimension structure, in which a ParentID column exists which points to a record from the same dimension table, using a SCD objects in SSIS. The ParentID column would have to be "Historical".

The challange here is that you would need to go through the table twice somehow, because if I would do a lookup of the parent record in the first run, I wouldn't be sure if I got the right parent record.

Thnx, Jeroen.

I don't understand the problem or question. I think if you define ParentID as 'historical' the SCD component will issue a new 'version' of the rows every time it detects a change in parentID value and it will 'expire' the previous 'version'. It’s just simple like that. It may be helpful is you provide an example of what you are trying to accomplish

|||

Why would your Id column change if you have a type2 change?

Are you using a typ2 column to lookup your parentID?

|||

Okay, let me try to give an example:

Lets say we have an employee named Doopie and his boss named Barkie, both in the dim_Employee table. In our case we work with start- and enddates.

ID Name ParentID Salary Stardate EndDate
10 Doopie 20 1000 1/1/1900 12/31/9999
20 Barkie NULL 4000 1/1/1900 12/31/9999

Okay, now, in the source system, Barkie gives himself a raise of 500. We want to track history of Salary. Now say we start the Data flow task with the Slowly changing dimension object. It could very well be, that Doopie's record is processed first. No changes there so Doopie's record remains unchanged. Now Barkie record which introduces a new row:

ID Name ParentID Salary Stardate EndDate
10 Doopie 20 1000 1/1/1900 31/12/9999
20 Barkie NULL 4000 1/1/1900 12/7/2006
21 Barkie NULL 4500 12/8/2006 31/12/9999

If Doopie's record was processed after the insert of Barkie's record, the lookup would return record 21 as the active Boss record, and introduce a new record for Doopie as well...

Thnx again!
Jeroen

|||

I see the problem now. Basically you need to make sure every child record point to the latest version of its parent.

Well, I don't see an easy way to do this at one pass. You may try to do an update after the dataflow with the SCD2 finish that assures every row is pointing to the latest version row of its parent. That could be safer in the case that an unchanged child row is not in your set of rows to be processed (assuming you are pulling only changed/new rows from the source). That is my best shot considering that I have not drunk my first coffee this morning

|||Why don't you normalize that table?|||

Phil wrote:

Why don't you normalize that table?

Hi Phil, I normalized some columns of it (name of parent), but the parent / child hierarchy goes about six or seven levels. So then I would have to add quite a few columns...

Rafael wrote:

You may try to do an update after the dataflow with the SCD2 finish that assures every row is pointing to the latest version row of its parent.

I can't just do an update, because the ParentID is defined as type 2 (historical) and should result in a new row for the child record as well...

Jeroen

|||

Jeroen Alblas wrote:

I can't just do an update, because the ParentID is defined as type 2 (historical) and should result in a new row for the child record as well...

So let's define 'historical'. Defining a column as 'historical' to me is intended to track changes on a particular attribute. In the example you gave at the beginning you said that no changes were made to the child row:

“No changes there so Doopie's record remains unchanged.”

So, why do you want to issue a new version of the child row? The only change that occurred was to the parent; hence you should generate a new row to the parent, expire the existing (parent)one and update all its children to point to new parent ID. After all, there is not change to track when you look at the child record.

In your example, I would issue a new row for Doopie only if I detected that Barkie is not anymore his manager; that way I would be tracking historical changes of the managers.

Under your approach, have you figured out what would happened if a change occurs to the topmost manager? You would have to generate a new row for the whole organization…kind of messy to me. BTW, the only way I see you could implement this is through recursive queries…if you are using SQL Server 2005 you could use Common table expressions for that.

|||

Indeed no changes are made to the attributes of the child record, unless you consider the ParentID column an attribute of the child record. And updating it will solve it for the current point in time, but as you can see in the example, yit would seem Doopie's parent would always have had a salary of 4500...

But I agree; if the topmost record would change I would get the whole tree inserted again ... Indeed that's not what I want.

So, I guess I will add the parent columns which must lead to a new child record (Firstname, Lastname, Login, etc) to the child record and update the ParentID to point to the active record of the parent.

Still, I think I must conclude that the dimensional modelling technique, at least to my knowledge, does not provide a good method of combining "tracking history" in combination with "recursive relationships".

Thnx, Jeroen

|||

The way I usually handle this is by using a business Key to uniquely identify each person (see EmployeeID)
If you have a single source for your employees, you can use that id, otherwise you have to generate one. Then, you
use this key for the relationship like so

ID EmployeeID Name ParentID Salary Stardate EndDate
10 100 Doopie 200 1000 1/1/1900 12/31/9999
20 200 Barkie NULL 4000 1/1/1900 12/31/9999

After the change the data would look like this:

ID EmployeeID Name ParentID Salary Stardate EndDate
10 100 Doopie 200 1000 1/1/1900 31/12/9999
20 200 Barkie NULL 4000 1/1/1900 12/7/2006
21 200 Barkie NULL 4500 12/8/2006 31/12/9999

|||

Jeroen Alblas wrote:

Indeed no changes are made to the attributes of the child record, unless you consider the ParentID column an attribute of the child record.

Indeed, I would not consider it an attribute of the child row.

Jeroen Alblas wrote:

And updating it will solve it for the current point in time, but as you can see in the example, yit would seem Doopie's parent would always have had a salary of 4500...

I disagree. It does not seem like Doopie's parent always have had a salary of 4500; what it actually seems is the current salary of her parent is 4500. You should not try to get historical information of a row through its children...I gues that should be part of educating end users on what a SCD 2 is and what is not.

Jeroen Alblas wrote:

But I agree; if the topmost record would change I would get the whole tree inserted again ... Indeed that's not what I want.

That is certanly not practical...

Jeroen Alblas wrote:

So, I guess I will add the parent columns which must lead to a new child record (Firstname, Lastname, Login, etc) to the child record and update the ParentID to point to the active record of the parent.

That was pretty much my original sugestion...good luck with that

|||

David Frommer wrote:

The way I usually handle this is by using a business Key to uniquely identify each person (see EmployeeID)

Thnx David. I do have the business key of the employee in the dimension. However, if you create a parent-child dimension in Analysis Services, you need a key which identifies a unique row in the dimension table. I didn't mention this before, but this is one of the things for which I use the column.

Jeroen

|||

Rafael Salas wrote:

You should not try to get historical information of a row through its children...I gues that should be part of educating end users on what a SCD 2 is and what is not.

Although I'm still convinced the ParentID is not quite as useful if it doesn't give the same result as joining using the business key in combination with start- and enddate, I think this a quite a good conclusion to wrap this up :) thnx.

Jeroen

Friday, March 23, 2012

Parent Child Dimension Question

I have a simple parent child dimension set up where the root level records have a ParentID of <null>.

When I browse the hierarchy the root level appear correctly, but when I drill into one of the levels of the hierarchy, the root level element is duplicated at the next level even though there is no such relationship in the dimension.

Here is a simplified example of records in the dimension:
ID Name ParentID
1 Root1 <NULL>
2 Level1 1
3 Root2 <NULL>
4 Level2 3

The hierarchy looks like this when I browse:
All
- Root1
- Root1
- Level1
- Root2
- Root2
- Level2

How can I keep the root elements from showing up at the 2nd level?

Did you set the "MembersWithData" property of the Parent attribute to "NonLeafDataHidden"?

http://msdn2.microsoft.com/en-us/library/ms174919(SQL.90).aspx

>>

MembersWithData

Used by parent attributes to determine whether to display data members for non-leaf members in the parent attribute. This property value is only used when the value of the Usage property is set to Parent, meaning that a parent-child hierarchy has been defined.

>>

|||

I didnt think that was the problem, but I did change the "MembersWithData" property from "NonLeafDataVisible" to "NonLeafDataHidden" and I still have the same problem.

I also noticed that the problem is not isolated to the root level members either, but each level repeats it's parent.

So my hierarchy really looks like:

All
- Root1
+ Root1 (leaf)
- Level1
- Level1 (leaf)
- Root2
+ Root2 (leaf)
- Level2
- Level2 (leaf)

When it should look like

All
- Root1
- Level1
- Leaf1
- Root2
- Level2
- Leaf2

I also have the appropriate primary and foreign key relationships defined in this dimension table.

Any other ideas?

Thanks in advance.

|||

Well, in my case, changing the "MembersWithData" property to "NonLeafDataHidden" fixed this issue (it is "NonLeafDataVisible" by default, according to BOL). So, do you find that switching this property on the Parent attribute has no effect on the visible hierarchy at all - which would be surprising?

PS: you can confirm this in the Adventure Works Employee dimension:

- on the Employees attribute, change the "MembersWithData" property to "NonLeafDataVisible"

- deploy the Employee dimension change and then browse the Employees parent-child hierarchy:

- you should now see each non-leaf node (starting with the root) also listed as a leaf child of itself

- switch the property back to "NonLeafDataHidden", re-deploy the dimension, and check by browsing

Parent Child Dimension Attribute Hierarchy

I hope I described that right!

I have a dimension attribute that describes a self referential hiearchy in the dimension. I have this setup and working with one exception. When I use this hierarchy I only want members which have children to be displayed at each level instead of all members regardless of whether they have children. How do I do this?

Thanks,

ChrisHey Chris,

If you don't display childless members at each level, where would they go? Aren't they leaf members, just at a higher level in the dimension based on their parents?

Not sure I understand why you would want to hide any members. Can you give an example or some more details?

Dave Fackler
|||I have a similar requirement.

I have a DIM_Customer with a Referred_By_Customer_Key, which stores a value if a particular customer happens to be referred by another customer, otherwise, NULL is stored.

Wizard auto detected that this is a Parent-Child hierarchy as it was a FK to its own PK.

When browsing the Dimension, it is showing
Parent Customer -> Referred Customer Level 1 -> Referred Customer Level 2...

However, a lot of customers havent referred anyone and are having 0 children in the hierarchy. How could these customers be hidden from view?

Using a regular attribute hierarchy seems easier to achieve this. I cannot figure out for Parent-Child.

Parent Child Dimension Attribute Hierarchy

I hope I described that right!

I have a dimension attribute that describes a self referential hiearchy in the dimension. I have this setup and working with one exception. When I use this hierarchy I only want members which have children to be displayed at each level instead of all members regardless of whether they have children. How do I do this?

Thanks,

ChrisHey Chris,

If you don't display childless members at each level, where would they go? Aren't they leaf members, just at a higher level in the dimension based on their parents?

Not sure I understand why you would want to hide any members. Can you give an example or some more details?

Dave Fackler
|||I have a similar requirement.

I have a DIM_Customer with a Referred_By_Customer_Key, which stores a value if a particular customer happens to be referred by another customer, otherwise, NULL is stored.

Wizard auto detected that this is a Parent-Child hierarchy as it was a FK to its own PK.

When browsing the Dimension, it is showing
Parent Customer -> Referred Customer Level 1 -> Referred Customer Level 2...

However, a lot of customers havent referred anyone and are having 0 children in the hierarchy. How could these customers be hidden from view?

Using a regular attribute hierarchy seems easier to achieve this. I cannot figure out for Parent-Child.

Tuesday, March 20, 2012

Parent Child Dimension AS 2000-2005

Hi,

I have a parent child dimension in AS 2000. Some of the accounts belongs to more then one parent and I have solved that by using formula expression that points to the original account member. The source table for the dimension looks like this:

AccountID AccountName ParentID Formula

1, 'A1', 10, ''

2, 'A2', 10,''

3, 'A1', 20, '[Account].&[1]'

10, 'P1', 10, ''

20, 'P2', 20, ''

I have tried to do the same in AS 2005 but I can not get it to work, should this type of dimension be implemented in a different way in AS 2005?

Thanks, Christer

You can use many-to-many dimension relationships to model this is AS 2005.

I have an article on my blog on pretty much this exact scenario at http://geekswithblogs.net/darrengosbell/articles/57811.aspx

Marco at www.sqlbi.eu has a very comprehensive white paper on some of the ways in which many-to-many relationships can be used in AS 2005.

|||

Thanks, I think Marco's multiple groups scenario could work for me. But does that mean that I have to deal with two dimensions? In AS 2000 i could use one dimension with two levels Item and ItemGroup, in this scenario it looks like it will be two separate dimensions.. correct?

/Christer

|||I beleive the very same approach you used in AS2000 should work in AS2005 as well (although alternative approach with M-to-M is also worth considering). You need to specify CustomRollupColumn to point to the "Formula" column - and it should work fine. Please provide more details what exactly did you do and what happened.|||

Mosha is probably right - I think your situation may be slightly different to the one that I was trying to solve with m-to-m relationships. As he said, can you tell us a bit more about what you did and what did not work?

If you do go down the m-to-m track you do not need a second dimension, what you need is a measure group that contains the relationship between which records in your fact table map to which account records in your dimension table. Below is a very simplistic fact table and m-to-m fact table. You should be able to prototype this sort of thing with views or named queries before making any structural changes.

eg,

Fact Table
==========

AccountID Amount
1 $20
2 $25

M-to-M Fact Table
==================

AccountID MappedAccountID
1 1
1 3
2 2

|||

ok - here is more details:

factAccount table: Id, AccountID, Hours

1, 1, 100

dimAccount table: AccountID, AccountName, ParentID, Formula

1, A1, 10
2, A1, 20, ([Account].[Accounts].&[1], [Measures].[Hours])
10, P1, 10
20, P2, 20

The Account dimension based on the dim table above is configured as parent-child and have following settings on its attributes:

PARENTID

Usage = Parent

Name = Accounts

ACCOUNTID

Usage = Key

NameColumn = AccountName

CustomRollupColumn = Formula

FORMULA

Usage = Regular

When browsing the cube in a pivotable I get no values for member A1 under P2 ([Account].[Accounts&[2]):

Account, Hours

P1 - A1, 100

P2 - A1, (empty)

Any idea?

Thanks, Christer

|||

OK - I think I know what the problem is. You need to define CustomRollupColumn = Formula on the Parent attrbute, not on the Key attribute. Let me know if this solved your problem.

HTH,

Mosha (http://www.mosha.com/msolap)

|||

Yes, it solved my problem!

Thanks!

Parent Child Dimension

Hi

I have a little problem.

I build a Parent - Child dimension an I need to change the default listing of this kind of dimensions to display some information from another column than ID and ParentID.

Is there eny way to solve that?

Tanks in advance for your help.

(AS 2005; Excel 2007)

You can change this in the name column for the the parent child primary key. Check the attribute pane in the dimension editor.

Regards

Thomas Ivarsson

|||thank you Thomas for your quick answer

Parent / Child as a referenced dimension

Hi there,

I have a classic Chart of Accounts dimension, implemented as a Parent / Child. This dimension binds to fact_gl_balances with a surrogate key, at the child account granularity. Let's call the dimension dim_gl_structure

So far, so good. I'm not experiencing any of the problems that other people have talked about with Parent / Child and surrogate key. Dunno why...

Now, however, I have another fact table that exists at a finer granularity - fact_gl_transactions. I have a (non-parent / child) dimension that binds to this table with a surrogate key at the transaction number level. It's called dim_gl_transactions. One of the attributes of this dimension is the surrogate key used for the child account in dim_gl_structure - so the dimensions should be able to join to each other.

What I want to do is be able to drill down through the parent / child hierarchy of dim_gl_structure, but go below the child account, into the transactions. I thought this would be easy - I though I'd create a new dimension, based on dim_gl_transactions table , relate it to dim_gl_structure, then use whichever attributes I required from both dims to create a suitable hierarchy.

When I go through the wizard, it detects the related table dim_gl_structure, but doesn't offer me any of the attributes it contains. Is this because it's Parent / Child? Am I trying to do something that is inherently impossible? Is the best answer to hack together a view, and base the new 'combo' dimension on that? And why would this be so hard? I don't get it......

Thanks in advance for any help you can give me.

Hello! I do not know about all your business requirements but I think that this is not about referenced dimension but more about granularity in different measure groups.

The second fact table have a different granularity than the first but it is probably not only about the relation between transactions and account but also about the time dimension that you have not described?

You should be able to aggregate the second fact table into the first fact table by ignoring the transaction key and only aggregate by account. Use the second fact table instead of the first.

I can be wrong but you said that you have the account key in both fact tables?

And i do not know if you have different granularity of measures within both fact tables, one of the few good reasons of using parent-child dimensions.

Are these two tables coming from two different source systems? One financial source and one transaction source system?

HTH

Thomas Ivarsson

|||

I don't know if the wizard will detect a referenced dimension like this. Have you tried setting it up manually in the dimension usage tab?

I was thinking along the same lines as Thomas. Parent child dimensions can really slow down as they get larger, so I would really think hard before adding transactions under the accounts. I would go the way Thomas suggested, maybe creating the view over dim_transaction and fact_transaction so that you can link directly to the account dimension.

|||

OK guys, I took your advice on board and got this working. It may be worth recording my approach, because this is a fairly generic problem

I decided not to go with a parent / child structure for dim_gl_structure, so I rebuilt the dim table to have fields gl_level_1, gl_level_2, etc, and designed the user hierarchies and attribute realtionships manually. I felt like I had a bit more control that way. That gave me dimension dim_gl_structure, which I bound to fact_gl_balance at the account_key granularity. Worked fine. I can now drill up from gl_account all the way up through the Chart of Accounts.

I then built dim_gl_trans table, which had the transaction key, the account key, and the dimension attributes. I put a foreign key between dim_gl_trans.account_key and dim_gl_structure.account_key in the database.

Then I created a dimension based on table dim_gl_transaction. Because of the foreign key, the dimension wizard detected table dim_gl_structure as a 'related table', and offered me all of the fields in both tables for attributes. At this point, you're pretty much there. Create a user hierarchy with transaction_key at the bottom, going up through account_key, gl_level_2, gl_level_1 etc.

[I have a suspicion that this may not work as well if one of the tables involved is a view. i.e. if you'd implemented dim_gl_trans as a table, but dim_gl_structure as a view, the 'related table' bit of this may fall over, and not offer you all of the attributes ]

This dimension(dim_gl_transaction) binds to fact_gl_transaction at the transaction_key granularity. This allows me to do what I Initially wanted i.e dill up from transaction all the way up therough the chart of accounts.

Thanks for your help.

|||

Glad you got it working

Sam Loud wrote:

[I have a suspicion that this may not work as well if one of the tables involved is a view. i.e. if you'd implemented dim_gl_trans as a table, but dim_gl_structure as a view, the 'related table' bit of this may fall over, and not offer you all of the attributes ]

It should not matter if the source is a view or a table as long as the logical relationships in the DSV are defined correctly.