【问题标题】:Power Query - Concatenate and TransposePower Query - 连接和转置
【发布时间】:2018-12-01 02:20:43
【问题描述】:

我在下面有一个数据表 (1),并希望得到表 (2) 中的结果。我该怎么做?

【问题讨论】:

    标签: excel powerbi powerquery m


    【解决方案1】:

    我建议如下:

    • 使用 Remove Rows > Remove Duplicates 删除重复行
    • 使用串联 (see this question) 对表进行分组
    • 使用拆分列 > 按分隔符拆分串联的 State 列。

    【讨论】:

      【解决方案2】:

      您可以使用以下代码:

      let
          Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
          group = Table.Group(Source, {"Name"}, {{"State", each Text.Combine(List.Distinct([State]), "|")}}),
          split = Table.SplitColumn(group, "State", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), {"State.1", "State.2", "State.3"})
      in
          split
      

      result

      【讨论】:

        【解决方案3】:

        看看这个话题:VBA excel, concatenate cells when there are duplicates

        您可以使用该 vlookupall 函数,然后在结果中使用“文本到列”。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-06-13
          • 2023-03-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多