Forum Discussion

Nick2's avatar
Nick2
Frequent Visitor
8 years ago
Solved

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 ...
  • v-yuta-msft's avatar
    v-yuta-msft
    8 years ago

    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