- //Unnamed
- let
- 源 = Excel.CurrentWorkbook(){[Name = "表1"]}[Content],
- 自定义1 = List.RemoveNulls(List.Combine(Table.ToColumns(源))),
- 转换为表 = Table.FromList(自定义1),
- 分组的行 = Table.Group(
- 转换为表,
- "Column1",
- {"计数", each Table.FromRows({[Column1]})},
- 1,
- (x, y) =>
- [
- fx = (a) =>
- List.Sum(
- List.Transform(
- Text.ToList(Text.BeforeDelimiter(a, "[")),
- Character.ToNumber
- )
- ),
- ex = fx(x) - fx(y)
- ][ex]
- ),
- 自定义2 = Table.ReplaceValue(
- 分组的行,
- "",
- "",
- (x, y, z) => Text.Select(x, {"一" .. "龥"}),
- {"Column1"}
- ),
- 自定义3 = 自定义2,
- #"展开的“计数”" = Table.ExpandTableColumn(
- 自定义3,
- "计数",
- {"Column1", "Column2", "Column3", "Column4"},
- {"Column1.1", "Column2", "Column3", "Column4"}
- ),
- 转置表 = Table.Transpose(#"展开的“计数”"),
- 提升的标题 = Table.PromoteHeaders(转置表, [PromoteAllScalars = true]),
- 更改的类型 = Table.TransformColumnTypes(
- 提升的标题,
- {
- {"张三", type text},
- {"李四", type text},
- {"王五", type text},
- {"孙悟空", type text},
- {"陈白白", type text}
- }
- )
- in
- 更改的类型
复制代码 |