数据源:
//分组美式排名
let
源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
分表 = Table.Group(源, "班级", {"分表", each Table.AddRankColumn(_, "排名", {"成绩", 1})}),
展开 = Table.ExpandTableColumn(分表, "分表", {"姓名", "成绩", "排名"})
in
展开
//分组中式排名
let
源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
分组 = Table.Group(源, "班级", {"内容1", each Table.AddIndexColumn(Table.Group(_, "成绩", {"内容2", each Table.Sort(_, {"成绩", 1})}), "排名", 1)}),
展开1 = Table.ExpandTableColumn(分组, "内容1", {"成绩", "内容2", "排名"}),
展开2 = Table.ExpandTableColumn(展开1, "内容2", {"姓名"}),
整理 = Table.ReorderColumns(展开2,{"班级", "姓名", "成绩", "排名"})
in
整理
标签:Table,Power,分组,排名,分表,Query,成绩,展开
From: https://www.cnblogs.com/officeplayer/p/17092202.html