Forum Discussion
help to transform a table on Powerquerry
- 1 year ago
I need further assistance since I've made more changes at the file. So It is not enough to copy the code and paste it (because it will clean all previous steps done by me).
Hi jps_HHH,
Thank you for reaching out to Microsoft Fabric Community.
To combine the columns and get the expected output, please follow below steps:
- Open Power bi desktop and load the table.
- Open the Power Query Editor and go to the Advanced Editor
-
Replace the existig code with the below code and click on Done:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSsssTk7MUahMTSxSMDJV0lEKzixJVTAEMhwLijJzgLSpgUJxak5OMZAJVlwEVWwCU2yEpNjEDKo4Vgef2b6JlUDSiBiTIUqNjYky16s0LxVIGZoSYTBUrakpkSbngNxhQoyToWqNiHOzY2l6aXEJSL0hMQENV02c6cGpBSWpuUmpRSAtJkRYgKLBEmZHLAA=", BinaryEncoding.Base64), Compression.Deflate)),
let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column 1" = _t, #"Column 2" = _t, #"Column 3" = _t, #"Column 4" = _t, #"Column 5" = _t, #"Column 6" = _t, #"Column 7" = _t, #"Column 8" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source, List.Transform(Table.ColumnNames(Source), each {_, type text})),
FirstHalf = Table.SelectColumns(#"Changed Type", {"Column 1", "Column 2", "Column 3", "Column 4"}),
SecondHalf = Table.SelectColumns(#"Changed Type", {"Column 5", "Column 6", "Column 7", "Column 8"}),
RenamedSecond = Table.RenameColumns(SecondHalf, {{"Column 5", "Column 1"}, {"Column 6", "Column 2"}, {"Column 7", "Column 3"}, {"Column 8", "Column 4"}}),
Combined = Table.Combine({FirstHalf, RenamedSecond}) in Combined
And the output will be like below:
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi jps_HHH
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Thanks and regards,
Anjan Kumar Chippa
- jps_HHH1 year agoHelper II
I need further assistance since I've made more changes at the file. So It is not enough to copy the code and paste it (because it will clean all previous steps done by me).