Forum Discussion

karelstoel's avatar
karelstoel
Advocate I
4 years ago
Solved

Rename rows

Hi,

 

I have append a few datasets in power query with in every dataset a 'Debiteuren' row. Is it possible to rename those rows/names to see the difference between them? See below.

 

Thanks in advance! Kind regards, Karel

 

 

  • Hi Fowmy,

     

    See below what I am looking for. I Would like to rename the rows so I can see what data is what. Thanks!

     

     

  • v-kkf-msft's avatar
    v-kkf-msft
    4 years ago

    Hi karelstoel ,

     

    Maybe you could add an index column and then replace the value of that column.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcklNyixJLS1KzVPSUTJQitVBEzIy0LM0NjU3wZQxNDDQMzM2MDHHlDI1t9AzMTQ1M8VinqWxBdBEY3NjLCYamVoY6plbGFsCNcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Naam = _t, Debiteuren = _t]),
        #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
        #"Changed Type1" = Table.TransformColumnTypes(#"Added Index",{{"Index", type text}, {"Debiteuren", type number}}),
        Substitutions = [
            1 = "Company X",
            2 = "Company Y",
            3 = "Company Z",
            4 = "Company V",
            5 = "Company K",
            6 = "Company J"],
        Substituted = Table.TransformColumns(#"Changed Type1", {{"Index", each Record.FieldOrDefault(Substitutions, _, _)}})
    in
        Substituted

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

3 Replies

    • karelstoel's avatar
      karelstoel
      Advocate I

      Hi Fowmy,

       

      See below what I am looking for. I Would like to rename the rows so I can see what data is what. Thanks!

       

       

      • v-kkf-msft's avatar
        v-kkf-msft
        Community Support

        Hi karelstoel ,

         

        Maybe you could add an index column and then replace the value of that column.

         

        let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcklNyixJLS1KzVPSUTJQitVBEzIy0LM0NjU3wZQxNDDQMzM2MDHHlDI1t9AzMTQ1M8VinqWxBdBEY3NjLCYamVoY6plbGFsCNcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Naam = _t, Debiteuren = _t]),
            #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
            #"Changed Type1" = Table.TransformColumnTypes(#"Added Index",{{"Index", type text}, {"Debiteuren", type number}}),
            Substitutions = [
                1 = "Company X",
                2 = "Company Y",
                3 = "Company Z",
                4 = "Company V",
                5 = "Company K",
                6 = "Company J"],
            Substituted = Table.TransformColumns(#"Changed Type1", {{"Index", each Record.FieldOrDefault(Substitutions, _, _)}})
        in
            Substituted

         

        If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

        Best Regards,
        Winniz

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