Unit_hierarchy
The syntax for Microsoft SQL Server is:
select * from unit_Hierarchy()
where top_mem in(
select mem_id
from ctrain.unit
where mem_name like '{Unit}'
)
When {Unit} is replaced by a selected member "US" from Unit dimension, the result is:
mem_id | mem_pid | level | top_mem |
---|---|---|---|
4 | -1 | 1 | 4 |
5 | 4 | 2 | 4 |
6 | 4 | 2 | 4 |
46 | 4 | 2 | 4 |