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
Mederic
Post Patron
Post Patron

Split a column into two separate columns

Hello,

I have a data range of approximately 2,000 rows, each containing the supplier number followed by the name.

The table is structured using this same logic throughout.

I would like to transform this column into two columns with the number and the name.

I have two methods that work, but I would like to optimise them with fewer steps.

If possible, I would also like to see one or two other methods suggested.

I am attaching a small sample file.

Thanks in advance

Best regards

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    group = Table.Group(
        Source, 
        "List", 
        {"fx", (x) => Record.FromTable(Table.SplitColumn(x, "List", Splitter.SplitTextByEachDelimiter({" "}), {"Name", "Value"}))}, 
        GroupKind.Local, 
        (s, c) => Number.From(Text.StartsWith(c, "Supplier"))
    ),
    z = Table.FromRecords(group[fx])
in
    z

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    result = Table.FromList(
        List.Split(Table.ToList(Source, (x) => Text.AfterDelimiter(x{0}, " ")), 2),
        (x) => x, 
        {"Supplier", "Name"}
    )
in
    result

 

View solution in original post

3 REPLIES 3
Mederic
Post Patron
Post Patron

Hello @OwenAuger , @AlienSx ,

Thank you for your solutions, which work very well.
Indeed, Table.Split and List.Split are very useful here.
I slightly prefer the code below from AlienSx Thank you for your solutions, which work very well.
Indeed, Table.Split and List.Split are very useful here.
I slightly prefer the code below from AlienSix, even though the other codes are also very good.
Thank you.
Have a nice day.
Best regards.:

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    result = Table.FromList(
        List.Split(Table.ToList(Source, (x) => Text.AfterDelimiter(x{0}, " ")), 2),
        (x) => x, 
        {"Supplier", "Name"}
    )
in
    result


Thank you.
Have a nice day.
Best regards.

AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    group = Table.Group(
        Source, 
        "List", 
        {"fx", (x) => Record.FromTable(Table.SplitColumn(x, "List", Splitter.SplitTextByEachDelimiter({" "}), {"Name", "Value"}))}, 
        GroupKind.Local, 
        (s, c) => Number.From(Text.StartsWith(c, "Supplier"))
    ),
    z = Table.FromRecords(group[fx])
in
    z

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    result = Table.FromList(
        List.Split(Table.ToList(Source, (x) => Text.AfterDelimiter(x{0}, " ")), 2),
        (x) => x, 
        {"Supplier", "Name"}
    )
in
    result

 

OwenAuger
Super User
Super User

Hi @Mederic 

Here's one suggestion:

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"List", type text}}),
    #"Split List" = List.Split(#"Changed Type"[List],2),
    #"Extract Text" = List.Transform(#"Split List", each { Text.AfterDelimiter(_{0},"Supplier "), Text.AfterDelimiter(_{1},"Name ") } ),
    #"Convert to Table" = Table.FromList(#"Extract Text", each _, type table[Supplier = text, Name = text])
in
    #"Convert to Table"

 List.Split is used to partition the list into pairs.

Depending on the source, there might be some need to ensure original row order is preserved when the list is split.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.