如何根据电源查询中另一个表中的值过滤表中的行 [英] How to filter rows in a table based on values in another table in power query

查看:17
本文介绍了如何根据电源查询中另一个表中的值过滤表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在电源查询中有两个表.

I have two tables in power query.

价格表

Date       Company  Price
01/01/2000  A        10
01/02/2000  A        12
01/03/2000  A        15
01/01/2000  B        15
01/02/2000  B        85
01/03/2000  B        98 

尺寸表

 Date      Company  Size
01/06/2000  A        10
01/06/2001  A        12
01/06/2002  A        15
01/06/2000  B        15
01/06/2001  B        85
01/06/2002  B        98 

在价格表中,我只想拥有大小表中的公司.换句话说,如果公司 C 不在尺寸表中,我不需要价格表中的公司数据点.这里不需要考虑日期.

In Price table, I want only to have companies which are in size table. In other words, If company C is not in the size table, I do not need that company data points in the price table. Here no need to consider the date.

推荐答案

在 Power Query 中,您可以使用 Merge Queries 功能来实现.(在功能区的 Home -->Combine 部分.

In Power Query you can use the Merge Queries function to achieve that. (In the Home --> Combine section of the ribbon.

选择 Join Kind 以确定要保留的行.

Select the Join Kind to determine which rows to keep.

在您的示例中,从第二个表创建一个查询并应用以下步骤:

In your example, create a query from the 2nd table and apply the following steps:

  • 删除日期和尺寸列
  • 删除重复项

之后,您可以将第一个表与新创建的查询连接起来并进行内部连接.(只保留匹配的条目)

Afterwards you can join the first table with the newly created query and do a inner join. (Only keep matching entries)

这篇关于如何根据电源查询中另一个表中的值过滤表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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