如何在电源查询中执行逐行列表操作

发布于 2025-02-02 00:37:16 字数 711 浏览 1 评论 0原文

我正在尝试将一个列中的CSV与Power查询同一行中另一行中的另一列中的CSV进行比较。我需要确保一列中的所有CSV都在另一列中。

我尝试使用list.containsall,但似乎我正在使用的语法不起作用。 在这里共享的解决方案非常接近我所需的内容,但是它比较列中的所有值,而不是单元格的值。 这是我的示例代码,但我认为此图片 更好地解释了父母 - 儿童列。此图显示另一种场景该功能也需要工作。

table.AddColumn(#“替换值”,“合同和技术类型匹配?”,每个list.Containsall({[[技术涡轮型]},{[[Contractual Turbine type]}))>

I'm trying to compare CSVs from one column with CSVs in another column in the same row in Power Query. I need to ensure that all the CSVs in one column are in the other.

I tried using List.ContainsAll, but it seems like the syntax I'm using is not working. The solution shared here is very close to what I need, but it's comparing all values in a column, not the cell's values.
Here is my sample code, but I think this picture explains the parent-child columns better. This picture shows another scenario where the function also needs to work.

Table.AddColumn(#"Replaced Value", "Contractual and Technical Types Match?", each List.ContainsAll({[Technical Turbine Type]},{[Contractual Turbine Type]}))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

英雄似剑 2025-02-09 00:37:16

您说您的列包含列表,但您的图像未显示列表。您的图像显示与逗号分开的文本。这就是列表的外观

”在此处输入图像描述”

假设您确实具有逗号分隔的文本列,这确保了合同涡轮类型列中的所有内容也位于技术中涡轮机类型

添加带有公式的自定义列,

= List.ContainsAll(        
    List.Transform(Text.Split([Technical Turbine Type],","), each Text.Trim(_)),
    List.Transform(Text.Split([Contractual Turbine Type],","), each Text.Trim(_))
    )

如果您不担心逗号之后的空间,则可以使用此列

= List.ContainsAll(        
    Text.Split([Technical Turbine Type],","),
    Text.Split([Contractual Turbine Type],",")
    )

You say your column contains a list but your image is not showing a list. Your image is showing text with commas separating them. This is what a list looks like

enter image description here

Assuming you really have columns of comma separated text, this ensures that everything in the Contractual Turbine Type column is also in the Technical Turbine Type column

Add custom column with formula

= List.ContainsAll(        
    List.Transform(Text.Split([Technical Turbine Type],","), each Text.Trim(_)),
    List.Transform(Text.Split([Contractual Turbine Type],","), each Text.Trim(_))
    )

You could just use this if you are not worried about spaces after the commas

= List.ContainsAll(        
    Text.Split([Technical Turbine Type],","),
    Text.Split([Contractual Turbine Type],",")
    )
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文