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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dobregon
Impactful Individual
Impactful Individual

Create a path with the info from other column

Hi guys, 

 

I'm looking to create a path with other info than the ids that form the path, let me explain. This is the info that i have as an example

IdParentIdHierarchyOrder
1NULLMountain1
2NULLCity2
3NULLBeach3
42Barcelona1
52Madrid2
62Valencia3
73Barceloneta1
83Macarella2
93Macarelleta3
103Turqueta4
111Teide1
121Everest2
131Pirineos3
141Kilimanjaro4


And i can create the path using the path function and i have something like this

IdParentIdHierarchyOrderPath
1NULLMountain11
2NULLCity22
3NULLBeach33
42Barcelona12|4
52Madrid22|5
62Valencia32|6
73Barceloneta13|7
83Macarella23|8
93Macarelleta33|9
103Turqueta43|10
111Teide11|11
121Everest21|12
131Pirineos31|13
141Kilimanjaro41|14

 

That i want to have is a similar path format looking all the parents in the hierarchy but form the column with the order, having the result of something like this

IdParentIdHierarchyOrderPathOrderPathOrderpathcorrected
1NULLMountain1111
2NULLCity2222
3NULLBeach3333
42Barcelona12|42|12.1
52Madrid22|52|22.2
62Valencia32|62|32.3
73Barceloneta13|73|13.1
83Macarella23|83|23.2
93Macarelleta33|93|33.3
103Turqueta43|103|43.4
111Teide11|111|11.1
121Everest21|121|21.2
131Pirineos31|131|31.3
141Kilimanjaro41|141|41.4


And it should be somethign with the path becasue i dont know how many levels of childs i will have in the future.

It could be possible?
Kind regards!



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @dobregon ,

 

For PATH function, The delimiter used to separate the ascendants is the vertical bar, '|'. We can use CONCATENATE to work around here.

Column 2 =
VAR a =
    CONCATENATE ( 'Table'[ParentId], "." & 'Table'[Order] )
RETURN
    IF ( 'Table'[ParentId] = BLANK (), "" & 'Table'[Order], a )

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

thanks for the response @v-frfei-msft , i have done this but it only works with hierarchies that can have only one parent or null parent. But if we take another example with more levels of hierarchy this doesnt work (example with a path lenght of 3)

IdParentIdHierarchyOrderPathOrderPathOrderpathcorrected
1NULLExpected1111
2NULLIncomes2222
32Bike12|32|12.1
42Motorbike22|42|22.2
52Losses32|52|32.3
65Theft12|5|62|3|12.3.1
77Broken22|5|72|3|22.3.2

 

And imagine that the pathlen could be something crazy and cant be do 100 levels of ifs in the powerbi. As the path function is automatic that searh all the hierarchy i'm looking for something similar.

I have created another calculated table with only the info from ids and order

IdOrder
11
22
31
42
53
61
72


and i'm looking if it is possible to calculate the column orderpath with a function like "PATHCONTAINS" but check all the rows in the column id and if it find subistute with the column order.

Regards!



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
dobregon
Impactful Individual
Impactful Individual

i have moved to the powerquery and try to do the query here, i have done the following m query in order to create the Path column like in DAX

 

/*Creating the path*/    
     PathColumn=Table.AddColumn(ChangedType, "Path", each let 
     myfunction=(myvalue)=>
                    let
                    mylist=Table.SelectRows(ChangedType,each [ID]=myvalue)[ParentId],
                    result=Text.Combine(mylist)
                    in
                    if result= null or result ="" then "" else if @myfunction(result)=null or @myfunction(result)="" then result else result & "|" & @ myfunction(result)
in
Text.Combine(List.Reverse(List.RemoveItems({[ID]}&{[ParentId]}&Text.Split(myfunction([ParentId]),"|"),{"",null})),"|"))
in
    PathColumn


With that i create a new column with the Path, and now i'm looking to create another custom column that replace each IDs in the path for a list of Order



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors