如何将具有相同 ID 的行合并到一个列表中 [英] How to combine rows with the same ID into a list

查看:31
本文介绍了如何将具有相同 ID 的行合并到一个列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能使下表像一个列表.

How can I make the below table like a list.

Id   Name
1    Tim
1    George
2    Rachael
3    Mark
3    Blake

我希望结果是这样的

Id    Name
1     Tim,George
2     Rachael
3     Mark,Blake

有什么想法吗?

推荐答案

试试下面的方法,或许能解决你的问题.

try the following, it may solve your problem.

假设您现有的表名为 yourTable,而要创建的新表名为 groupedNames.在数据视图中,单击新表并粘贴以下内容:

Let's say your existing table name is yourTable and the new table to be created is groupedNames. in data view, click on new table and paste the following:

groupedNames = calculatetable
(
    addcolumns(
        summarize(yourTable ,yourTable[Id ]),
        "Names",calculate(CONCATENATEX(yourTable,[ Name ],","))
    )   
)

这篇关于如何将具有相同 ID 的行合并到一个列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆