Forum Discussion
Anonymous
4 years agoNot applicable
difference of two columns
what will be the syntax for list.difference
col1 col2 output
1 3 1
2 4 2
3 5
4
5
Use this. Replace Source line completely with your source.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJWitWJVjICskzALGMgC8wwgTFMwYxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}}), BuffList1 = List.Buffer(#"Changed Type"[Column1]), BuffList2 = List.Buffer(#"Changed Type"[Column2]), DiffList = List.Difference(BuffList1,BuffList2), Result = Table.FromColumns(Table.ToColumns(#"Changed Type")&{DiffList},Table.ColumnNames(#"Changed Type")&{"Result"}) in Result
1 Reply
- Vijay_A_VermaMost Valuable Professional
Use this. Replace Source line completely with your source.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJWitWJVjICskzALGMgC8wwgTFMwYxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}}), BuffList1 = List.Buffer(#"Changed Type"[Column1]), BuffList2 = List.Buffer(#"Changed Type"[Column2]), DiffList = List.Difference(BuffList1,BuffList2), Result = Table.FromColumns(Table.ToColumns(#"Changed Type")&{DiffList},Table.ColumnNames(#"Changed Type")&{"Result"}) in Result