Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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?

Robin98908_0-1647440325469.png

 

 

The folder structure should look like this at the end.

Robin98908_1-1647440419298.png

 

Thanks for your help

Robin 

1 ACCEPTED SOLUTION
Hariharan_R
Solution Sage
Solution Sage

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

Hariharan_R_2-1647535464163.png

 

 

Hariharan_R_1-1647535436225.png

 

Result

Hariharan_R_0-1647535410242.png

Thanks

Hari

 

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

View solution in original post

1 REPLY 1
Hariharan_R
Solution Sage
Solution Sage

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

Hariharan_R_2-1647535464163.png

 

 

Hariharan_R_1-1647535436225.png

 

Result

Hariharan_R_0-1647535410242.png

Thanks

Hari

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.