Reputation: 12621
I'm planning to create a dimension Location
in my existing cube, based on a production database. The problem is that this database consists of a hierarchy with a selfreferencing object, a table called locations:
+----+----------+------------+
| id | parentId | name |
+----+----------+------------+
| 1 | NULL | Building A |
+----+----------+------------+
| 2 | 1 | Floor 1 |
+----+----------+------------+
| 3 | 2 | Room 11 |
+----+----------+------------+
| 4 | 2 | Room 12 |
+----+----------+------------+
| 5 | 2 | Room 13 |
+----+----------+------------+
| 6 | 1 | Floor 2 |
+----+----------+------------+
| 7 | 6 | Room 21 |
+----+----------+------------+
| 8 | 6 | Room 22 |
+----+----------+------------+
| 9 | NULL | Building B |
+----+----------+------------+
| 10 | 9 | Room 1 |
+----+----------+------------+
| 11 | 9 | Room 2 |
+----+----------+------------+
| 12 | 9 | Room 3 |
+----+----------+------------+
| 13 | NULL | Storage |
+----+----------+------------+
| 14 | NULL | Reception |
+----+----------+------------+
Normally I'd create a hierarchy like a date, the attribute month is a parent of attribute day and attribute year is a parent of attribute month. However, in this case the attribute Name
from dimension Location
could be the parent of another Name
.
How can I create a hierarchy out of these records?
Upvotes: 2
Views: 52
Reputation: 13315
This is what Parent Child Hierarchies are meant for. See documentation.
Upvotes: 2