Forum Discussion
magus
Helper I
5 years agoMerging to files upon common Value
Hello, I am using a TXT file as a source data to analyze the information about the Custromers. My unique value is a Customer ID and the rest of the columns are displaying information regarding those...
- 5 years ago
Hi magus ,
Try to add Index columns and join the table with itself:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pco9DoAgDAXgu7yZoa0t0FWMLk4mDoZw/2sIjK5O7ydfrWBiWTzFjIDjEtK99IYWKkYGmNJcA6qrSP/W01S2+yc0ItLIluOUbqk8H+mK1l4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Customer ID" = _t, #"Delivery number" = _t, Column1.23 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Customer ID", Int64.Type}, {"Delivery number", type text}, {"Column1.23", Int64.Type}}), #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index0", 0, 1), #"Added Index1" = Table.AddIndexColumn(#"Added Index", "Index1", 1, 1), #"Merged Queries" = Table.NestedJoin(#"Added Index1", {"Index1"}, #"Added Index1", {"Index0"}, "SecondNextRow", JoinKind.LeftOuter), #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Column1.23", "Index0", "Index1"}), #"Expanded SecondNextRow" = Table.ExpandTableColumn(#"Removed Columns", "SecondNextRow", {"Column1.23"}, {"Column1.23"}), #"Filtered Rows" = Table.SelectRows(#"Expanded SecondNextRow", each ([Customer ID] <> null)) in #"Filtered Rows"Reference: How to shift cells up or down in Power BI?
Best regards
Icey
If this post helps,then consider Accepting it as the solution to help other members find it faster.
Anonymous
5 years agoNot applicable
Hi magus - I guess the data forwarding in two different columns is because you might have Tab or multiple spaces between the values?
Is there a possibility you can convert you txt file to CSV/Excel and this should fall in one column when loaded to power BI?
Alternative, you can try Transform once in Power Query (Right click Fill Up Column1 and remove null from Customer ID) and and it will automatically do everytime you load the data.
Hope this helps.
Cheers,
-Namish B