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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.