PDA

View Full Version : PQ-Get each student list from each subject



sandy666
07-10-2023, 01:18 PM
SourceResult

NAMEGood at subject AGood at subject BGood at subject CGood at subject DGood at subject ElanguagemathEnglishhistorygeography

ABClanguagemathEnglishhistorygeographyABCABCABCABC ABC

CDEmathgeographyHIJCDEEFGEFGCDE

EFGEnglishmathhistoryEFGHIJHIJ

HIJhistorygeographylanguagemathHIJXYZ

XYZmathhistoryXYZ



// Query1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
UOC = Table.UnpivotOtherColumns(Source, {"NAME"}, "Attribute", "Value"),
Grp = Table.Group(UOC, {"Value"}, {{"Count", each [NAME]}}),
Result = Table.FromColumns(Grp[Count],Grp[Value])
in
Result