Forum Discussion
Fill in text strings from one column by using data from another, and then doing it vice-versa
- 3 years ago
Hi all,
this is another option to resolve it:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNglU0lFydHJ2AVJOOYkZSrE60UpYhGBKsYmhqzU1M7cA8l3d3D1AOpCEgCgyMSURZglUBVwIVSNEOBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Prod Code A" = _t, #"Prod Code B" = _t, #"Prod Code Description" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Prod Code A", type text}, {"Prod Code B", type text}, {"Prod Code Description", type text}}), #"Replaced Value" = Table.ReplaceValue(#"Changed Type", each {[Prod Code A], [Prod Code B]}, null, (x, y, z)=> if y{0} = "" then y{1} else (if y{1} = "" then y{0} else x),{"Prod Code A", "Prod Code B"}) in #"Replaced Value"jackieremidez , you need to replace the reference to #"Changed Type" in Table.ReplaceValue(#"Changed Type" to the name of your last step before this needs to be actioned.
Cheers,
John
Hi,
I should have mentioned that a) my skills are limited, b) the table I'm trying to use for my data is 16 appended Excel files (Jan2022_1, Jan2022_2, Feb2022_1, Feb2022_2, etc.) which I am calling Jan-Aug2022, and c) there are other columns in the file that I don't need to manipulate (yet, and this might be irrelevant). So...I'm trying to test your code below, which works beautifully and returns the sample data...but I don't know how to use my own combined table as the data source. Thank you again for your help!