Forum Discussion
Group then Transpose/Pivot with Text values
- 6 years ago
hi clgrantmidd
Just try these steps in the edit queries:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZI9a8NADIb/ivCcwc3QkNFNaYuhEGLSDiaD6lOw4HxndLKD/33OLmkgmUo8CX3wvHqFyjJZrtJ09ZQski+sUNk7eOucifkYgAMcvcClF8sbFG+haFjry9COWi+aHBb/p71izwZy7yjErKhqb1FCze0j0A0qfPou0HzInEQGyKT7wRlcF2jtAN9sLWMzGdfOkFPITiiGzC/0OV2uY++dHAnGk1+d3PiKAnsnFFS4Uhp1c0/wgQ1bnfTu9n0A/UI9ybg9apgdviUl+Xuuu6sczg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [FundID = _t, FundDesc = _t, #"Fund Notes" = _t, #"Relationship Name" = _t, #"Relationship Type" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"FundID", Int64.Type}, {"FundDesc", type text}, {"Fund Notes", type text}, {"Relationship Name", type text}, {"Relationship Type", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"FundID", "FundDesc", "Fund Notes", "Relationship Type"}, {{"Data", each _, type table [FundID=number, FundDesc=text, Fund Notes=text, Relationship Name=text, Relationship Type=text]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([Data],"Relationship Name")), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}), #"Extracted Values" = Table.TransformColumns(#"Removed Columns", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}), #"Pivoted Column" = Table.Pivot(#"Extracted Values", List.Distinct(#"Extracted Values"[#"Relationship Type"]), "Relationship Type", "Custom") in #"Pivoted Column"Result:
and here is sample pbix file, please try it.
Regards,
Lin
if you can separate the values that would be best, as it would still require me to manually type and fix stuff in that format
Here you go, thank you
FundID,FundDesc,Fund Notes,Relationship Name,Relationship Type
270071,Vacation Fund,Fund is for Vacation,Carol Smith,Fund Report
270071,Vacation Fund,Fund is for Vacation,David Jones,Scholarship Report
270071,Vacation Fund,Fund is for Vacation,Cat Mouse,Scholarship Report
270071,Vacation Fund,Fund is for Vacation,Jerry Aruba,Fund Report
270071,Vacation Fund,Fund is for Vacation,Sally Williams,Student Awarded
26029,General Scholarship,Scholarship is Unrestricted,Joe Hamilton,Fund Report
26029,General Scholarship,Scholarship is Unrestricted,Beverly Watson,Fund Report
26029,General Scholarship,Scholarship is Unrestricted,Peter Smith,Student Awarded