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
Ju7438
Regular Visitor

Unfold a path to lines

Hello Everyone, 

 

Im currentky struggleling with Power BI, here is the situation, i have a table with 1 column containing multiple path with "/" as separator.

e.i :

 

Context
A/B/C
A1/A2/A3/A4

 

I need to transform it like that with 2 colums 'Name' and 'Context' :

 

NameContext
A 
BA
CA/B
A1 
A2A1
A3A1/A2
A4A1/A2/A3

 

Did someone can helping me with that ? in power query or DAX it's the same for me...

 

Thanks in advance !

 

Julien

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Ju7438 

For your need , i can be realized in Power Query Editor.

You can put this M code in "Advanced Editor" to refer to :

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WctR30ndWitUBsgz1HY30HY31HU2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Context = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Context", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (x)=>Text.Split(x[Context],"/")       ),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom2", (x)=>    
 Table.AddColumn(Table.FromColumns({{0..List.Count(x[Custom])-1}}),"test",(y)=>   Text.Combine(List.Range(x[Custom],0,y[Column1]),"/") )[test]      
  ),
    Custom1 = Table.FromColumns({List.Combine(#"Added Custom1"[Custom]) ,  List.Combine(#"Added Custom1"[Custom2])})
in
    Custom1

 

vyueyunzhmsft_0-1670986639052.png

Then we can meet your need:

vyueyunzhmsft_1-1670986649654.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

2 REPLIES 2
Ju7438
Regular Visitor

Hi,

 

Sorry for the late response, it's working weel for me your solution fit perfectly with my neededs !

 

Thanks a lot !

 

BR 

 

Julien

v-yueyunzh-msft
Community Support
Community Support

Hi , @Ju7438 

For your need , i can be realized in Power Query Editor.

You can put this M code in "Advanced Editor" to refer to :

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WctR30ndWitUBsgz1HY30HY31HU2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Context = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Context", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (x)=>Text.Split(x[Context],"/")       ),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom2", (x)=>    
 Table.AddColumn(Table.FromColumns({{0..List.Count(x[Custom])-1}}),"test",(y)=>   Text.Combine(List.Range(x[Custom],0,y[Column1]),"/") )[test]      
  ),
    Custom1 = Table.FromColumns({List.Combine(#"Added Custom1"[Custom]) ,  List.Combine(#"Added Custom1"[Custom2])})
in
    Custom1

 

vyueyunzhmsft_0-1670986639052.png

Then we can meet your need:

vyueyunzhmsft_1-1670986649654.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

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