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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

power query split column by variable positions

Hi Community

I need to split Column1 based on variable postions from Custom.1  column. Same postion values stored as a list in Custom.3 column 

I have tried using the list as an argument in  Splitter.SplitTextByPositions but it didn't work

Thanks in advance 

MQO_0-1653590049249.png

Column1Custom.1
A B C0;2;4
4 5 60;2;4
A       B       C0;8;16
1       2       30;8;16
A  B    C0;3;8
11 22   330;3;8

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use below formula in a custom column

= Splitter.SplitTextByPositions(List.Transform(Text.Split([Custom.1],";"),each Number.From(_)))([Column1])

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test  

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclRwUnBW0lEysDayNlGK1YlWMlEwVTBDEUGosbA2NAMLGSoYKRijCiFUGVtbQBQBVQGVGaMIOjo51xgaGZuYQkWBVsQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Custom.1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Splitter.SplitTextByPositions(List.Transform(Text.Split([Custom.1],";"),each Number.From(_)))([Column1]))
in
    #"Added Custom"

 

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use below formula in a custom column

= Splitter.SplitTextByPositions(List.Transform(Text.Split([Custom.1],";"),each Number.From(_)))([Column1])

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test  

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclRwUnBW0lEysDayNlGK1YlWMlEwVTBDEUGosbA2NAMLGSoYKRijCiFUGVtbQBQBVQGVGaMIOjo51xgaGZuYQkWBVsQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Custom.1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Splitter.SplitTextByPositions(List.Transform(Text.Split([Custom.1],";"),each Number.From(_)))([Column1]))
in
    #"Added Custom"

 

Anonymous
Not applicable

Thanks, it worked on my data but not from your Source, may be because it removed some blanks

However, I modified it to CSV rather than JSON as below 

Thanks again

 

 

 

 

let
    Source = Csv.Document(
"Column1,Custom.1
A B C,0;2;4
4 5 6,0;2;4
A       B       C,0;8;16
1       2       3,0;8;16
A  B    C,0;3;8
11 22   33,0;3;8",2,","),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),

    #"Added Custom" = Table.AddColumn(#"Promoted Headers", "Custom", each Splitter.SplitTextByPositions(List.Transform(Text.Split([Custom.1],";"),each Number.From(_)))([Column1])),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ":"), type text})
in
    #"Extracted Values"

 

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.