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

查看:73
本文介绍了如何将具有相同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天全站免登陆