如何基于Power查询中另一个表中的值过滤表中的行 [英] How to filter rows in a table based on values in another table in power query
问题描述
我在电源查询中有两个表.
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->合并
部分中.
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)
这篇关于如何基于Power查询中另一个表中的值过滤表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!