Forum Discussion
Need Help Importing Data and Changing Table in Power Query
- 3 years ago
Anonymous
Use below M Code you don't need duplicate Query and merge Query. you get one query in result.let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WioiMMjQyNlHSUTIEYkelWB1kMSMgDoKJGRgYgNQYI6sDioHUmKCpA4mZoomB9Jmh6QWJmQNxMJqYBURvLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [UniqueID = _t, PolicyNumber = _t, Group = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"UniqueID", type text}, {"PolicyNumber", Int64.Type}, {"Group", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"UniqueID"}, {{"PolicyNumber", each List.Max([PolicyNumber]), Int64.Type},{"Group",each Text.Combine(List.Distinct([Group])), type text}})
in
#"Grouped Rows"
** If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.
Anonymous
Use below M Code you don't need duplicate Query and merge Query. you get one query in result.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WioiMMjQyNlHSUTIEYkelWB1kMSMgDoKJGRgYgNQYI6sDioHUmKCpA4mZoomB9Jmh6QWJmQNxMJqYBURvLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [UniqueID = _t, PolicyNumber = _t, Group = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"UniqueID", type text}, {"PolicyNumber", Int64.Type}, {"Group", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"UniqueID"}, {{"PolicyNumber", each List.Max([PolicyNumber]), Int64.Type},{"Group",each Text.Combine(List.Distinct([Group])), type text}})
in
#"Grouped Rows"
** If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.