let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Group = Table.Group(Source, {"TITLE", "NAME"}, {{"Count", each _, type table}}),
Subject = Table.AddColumn(Group, "Subject", each [Count][Subject]),
ExtractSubject = Table.TransformColumns(Subject, {"Subject", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
Grade = Table.AddColumn(ExtractSubject, "Grade", each [Count][Grade]),
ExtractGrade = Table.TransformColumns(Grade, {"Grade", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
Score = Table.AddColumn(ExtractGrade, "Score", each [Count][Score]),
ExtractScore = Table.TransformColumns(Score, {"Score", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
SplitSubject = Table.SplitColumn(ExtractScore, "Subject", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Subject.1", "Subject.2", "Subject.3", "Subject.4", "Subject.5", "Subject.6"}),
SplitGrade = Table.SplitColumn(SplitSubject, "Grade", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Grade.1", "Grade.2", "Grade.3", "Grade.4", "Grade.5", "Grade.6"}),
SplitScore = Table.SplitColumn(SplitGrade, "Score", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Score.1", "Score.2", "Score.3", "Score.4", "Score.5", "Score.6"}),
Reorder = Table.ReorderColumns(SplitScore,{"TITLE", "NAME", "Count", "Subject.1", "Grade.1", "Score.1", "Subject.2", "Grade.2", "Score.2", "Subject.3", "Grade.3", "Score.3", "Subject.4", "Grade.4", "Score.4", "Subject.5", "Grade.5", "Score.5", "Subject.6", "Grade.6", "Score.6"}),
Type = Table.TransformColumnTypes(Reorder,{{"TITLE", type text}, {"NAME", type text}, {"Count", type any}, {"Subject.1", type text}, {"Grade.1", type text}, {"Score.1", Int64.Type}, {"Subject.2", type text}, {"Grade.2", type text}, {"Score.2", Int64.Type}, {"Subject.3", type text}, {"Grade.3", type text}, {"Score.3", Int64.Type}, {"Subject.4", type text}, {"Grade.4", type text}, {"Score.4", Int64.Type}, {"Subject.5", type text}, {"Grade.5", type text}, {"Score.5", Int64.Type}, {"Subject.6", type text}, {"Grade.6", type text}, {"Score.6", Int64.Type}})
in
Type