2

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

enter image description here

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?

Josh Gallagher
  • 5,211
  • 2
  • 33
  • 60
Menno
  • 12,175
  • 14
  • 56
  • 88

1 Answers1

2

This is what Parent Child Hierarchies are meant for. See documentation.

FrankPl
  • 13,205
  • 2
  • 14
  • 40