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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
des_san
Advocate I
Advocate I

Create a hierarchy from a single field

Hi everyone, I need help creating a hierarchy from a single field, Project ID, that can be used in reports. Here is an example of what the data in that field looks like:

 

PROJECT

PROJECT.01

PROJECT.01.01

PROJABC

PROJABC.001

PROJABC.001.01

PROJABC.001.01.M01

PRJ1234

PRJ1234.ADM

PRJ1234.ADM.123

...

 

How should I go about this?

I saw a other posts that reference PATH() but that doesn't look like the right solution.

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

PATH() is correct.  Replace all periods with pipes.  Then use PATH.

View solution in original post

v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution @lbendlin  provided, it is excellent, and i want to offer some more information for user to refer to.

hello @des_san , based on your description, you can refer to the following solution.

Sample data 

vxinruzhumsft_0-1714457788818.png

You can create the following calculated columns

Path = SUBSTITUTE([Column1],".","|")
Level 1 = PATHITEM([Path],1)
Level 2 = PATHITEM([Path],2)
Level 3 = PATHITEM([Path],3)
Level 4 = PATHITEM([Path],4)

Output

vxinruzhumsft_1-1714457892987.png

 

If the solutions @lbendlin  and i provided can help you solve the problem , please consider to mark them as a solution.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
des_san
Advocate I
Advocate I

Thanks @lbendlin and @v-xinruzhu-msft .
I was reluctant to use PATH at first because it requires me to create a custom column for each level of the Project ID. Is there a more dynamic/flexible solution that can adjust automatically to the Project ID levels? 

Follow up question:
I created a hierarchy field with the Path Level fields. Is it possible to hide levels that are blank (or skip them)? In the example above, the first project has 3 levels and the second project has 4 levels.  As a result, the first project is showing a redundant blank 4th level. How would you approach this?

I will post the follow-up question as a new question. 

v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution @lbendlin  provided, it is excellent, and i want to offer some more information for user to refer to.

hello @des_san , based on your description, you can refer to the following solution.

Sample data 

vxinruzhumsft_0-1714457788818.png

You can create the following calculated columns

Path = SUBSTITUTE([Column1],".","|")
Level 1 = PATHITEM([Path],1)
Level 2 = PATHITEM([Path],2)
Level 3 = PATHITEM([Path],3)
Level 4 = PATHITEM([Path],4)

Output

vxinruzhumsft_1-1714457892987.png

 

If the solutions @lbendlin  and i provided can help you solve the problem , please consider to mark them as a solution.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

PATH() is correct.  Replace all periods with pipes.  Then use PATH.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.