Forum Discussion
Anonymous
4 years agoNot applicable
replace Duplicate values for each source in the one query
Good day All, I have a query consists of varius sorce files. Some files have dublications. Is there is a way to exchage dublicated values within the query but for each source only, see below: ...
- 4 years ago
Hi Anonymous ,
Perhaps you can try:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NFfSUTLKS1HwT0vLTE4tUorVQZbxKtJTMMYpa1yES8apKDMlPVUhJDUxF0nGEijjm1hcgqIcJOickZmahsUoS5yOs8RpPX4ZrA4zMsDiMLAgDoeB5bA6jIAMVoeBZVAcFgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source = _t, Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Source", type text}, {"Value", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Source"}, {{"Data", each _, type table [Source=nullable text, Value=nullable text]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Distinct([Data])), #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Value"}, {"Value"}), #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}), #"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Value", type text}}) in #"Changed Type1"Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yingjl
4 years agoCommunity Support
Hi Anonymous ,
Perhaps you can try:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NFfSUTLKS1HwT0vLTE4tUorVQZbxKtJTMMYpa1yES8apKDMlPVUhJDUxF0nGEijjm1hcgqIcJOickZmahsUoS5yOs8RpPX4ZrA4zMsDiMLAgDoeB5bA6jIAMVoeBZVAcFgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Source", type text}, {"Value", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Source"}, {{"Data", each _, type table [Source=nullable text, Value=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Distinct([Data])),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Value"}, {"Value"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Value", type text}})
in
#"Changed Type1"
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.