Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Getting fact table data based on traversing a Flat hierarcy table

HI all,

 

I have put a lot of work in building a Flattend hierarchy table in my data model but now I want to use it in certain ways but I cannot figure out how to make it work. 

 

My data looks a bit like this

id         Name

1Captain america
2Falcon
3Ant Man
4Thor
5Ironman
6Vision
7Wolverine

 

Avengers Expenses
IDExpence
1200
1250
2500
3100
4200
5300
5150
6200

 

IDParentID% PathdepthLevel 1Level 2Level 3
1  11Captain America 
211001|22Captain AmericaFalcon 
311001|32Captain AmericaAnt man 
42502|43Captain AmericaFalconThor
45505|42IronmanThor 
5  51Ironman  
651005|62Ironmanvision 
7  71Wolverine  

 

My data model like this:

In my dataset are alot of avenger teams and a lot more fact tables but this is de general design. 

 

I want to be able to traverse the hierarcy and use it to filter the fact table

 

For Example by a slicer on [name] from the [Avengers] table.  I want all the expenses from Avengers who are one level Above say Thor (950) or every parent above thor (including Cap 1400).

Also I would want everybody below eg, Iron Man multiplied by the % of ownership, so only 50% of the cost of Thor can be atributed to Iron Man. 

 

I would also like to be able to by slicing on a name get all avengers which are they are linked. The result should return all avengers exept Wolverine because he is not in any way linked to the others. 

 

I hope you can help me, thanks in advance!

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have included a Sample file. Maybe thats more handy

     

    Sample file