Forum Discussion
tmul
5 years agoFrequent Visitor
Conditional column merge
Hi, I have the following problem of merging columns. I have a dataset with around 70 columns. It is a result from a merge with another dataset and some columns contain the same data. I would like t...
- 5 years ago
Use Table.CombineColumns() to achieve your goal.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlXSUVKK1YlWMgMyzMAsEyDLHMwCMiyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Master column A" = _t, #"Sub column A" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Master column A", Int64.Type}, {"Sub column A", Int64.Type}}), #"Combined Columns" = Table.CombineColumns(#"Changed Type", {"Master column A", "Sub column A"}, each if _{0} is null then _{1} else _{0}, "Combined column A") in #"Combined Columns"