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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Nick2
Frequent Visitor

Split several columns at once

Hey guys,

 

quick an dirty, I have a lot of columns, that need to be split. All in the same way, in several tabels. Is it possible to do this at once, at best in all tables at the same time, or at least in one table at the same time?

 

Thanks and greetings

 

Nick

1 ACCEPTED SOLUTION

Hi Nick2,

 

To operate one time, you can click Advanced Editor and add M code like pattern below:

let
    Source = ......,
    #"Changed Type" = ......,
    #"Step 1" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Step 1",{{"Column1.1", type text}, {"Column1.2", type text}}),
    #"Step 2" = Table.SplitColumn(#"Changed Type1", "Column2", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column2.1", "Column2.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Step 2",{{"Column2.1", type text}, {"Column2.2", type text}}),
    #"Step 3" = Table.SplitColumn(#"Changed Type2", "Column3", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column3.1", "Column3.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Step 3",{{"Column3.1", type text}, {"Column3.2", type text}})
    ......
    #"Changed TypeN" = Table.TransformColumnTypes(#"Step N",{{"ColumnN.1", type text}, {"ColumnN.2", type text}})
in
    #"Changed TypeN"

Regards,

Jimmy Tao

 

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

Hi Nick2,

 

Click Editor Queries-> Transform, then click on the columns you want to split and click Split Column.

1.PNG2.PNG 

 

Regards,

Jimmy Tao

Hey

 

that's what I wanted to do, but as soon as I select more then one column the button becomes gray and I can't use it.

Do you have any explanation or tipp  why this might be the case and how I can solve it?

 

Greetings,

 

Nick

Hi Nick2,

 

To operate one time, you can click Advanced Editor and add M code like pattern below:

let
    Source = ......,
    #"Changed Type" = ......,
    #"Step 1" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Step 1",{{"Column1.1", type text}, {"Column1.2", type text}}),
    #"Step 2" = Table.SplitColumn(#"Changed Type1", "Column2", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column2.1", "Column2.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Step 2",{{"Column2.1", type text}, {"Column2.2", type text}}),
    #"Step 3" = Table.SplitColumn(#"Changed Type2", "Column3", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column3.1", "Column3.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Step 3",{{"Column3.1", type text}, {"Column3.2", type text}})
    ......
    #"Changed TypeN" = Table.TransformColumnTypes(#"Step N",{{"ColumnN.1", type text}, {"ColumnN.2", type text}})
in
    #"Changed TypeN"

Regards,

Jimmy Tao

 

That did work, thank you very much!
Maybe for other people with the same problem and not much knowledge in M, what I did is do it by hand one time, copy the code and just change the adress it was referring to.

 

Greetings,

 

Nick

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.