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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.