Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create folder structure with ids

Hello guys,

I need your help around a folder structure. In the screenshot are the names of the folders and the IDs. The fk_id always points to the parent folder. The data is not complete so don't be surprised if some fk_ids can't be found in the column id. What is the best way to create a proper and correct order structure over several levels?

 

 

The folder structure should look like this at the end.

 

Thanks for your help

Robin 

  • Hi Anonymous 

    You can achieve this with DAX PATH functions. You need to add calculated columns for all the levels.

     

    Full Hierarchy = PATH('Sample'[id],'Sample'[fk_id])
    Level 1 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],1,1))
    Level 2 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],2,1))
    Level 3 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],3,1))

     

     

     

    Result

    Thanks

    Hari

     

    If this helps to achieve the solution then please accept this as a solution.

1 Reply

  • Hi Anonymous 

    You can achieve this with DAX PATH functions. You need to add calculated columns for all the levels.

     

    Full Hierarchy = PATH('Sample'[id],'Sample'[fk_id])
    Level 1 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],1,1))
    Level 2 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],2,1))
    Level 3 = LOOKUPVALUE('Sample'[name],'Sample'[id],PATHITEM('Sample'[Full Hierarchy],3,1))

     

     

     

    Result

    Thanks

    Hari

     

    If this helps to achieve the solution then please accept this as a solution.