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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.