Power Query M公式语言外键检查

Power Query M formula language foreign key checking

我目前正在使用 Power BI Power Query 编辑器使用 Power Query M 公式语言编写查询。我目前有两个 table,名为 employeebusinessemployee table 的每一行都有一个 business_id 连接到 business table 的一行。我想 运行 一个 Table.SelectRows 函数只包含 employee.business_id = business.id.

的行

这是我目前拥有的:

let
    Source = MySQL.Database(<DATABASE>, "business_database", [ReturnSingleDatabase=true, CreateNavigationProperties=false]),
    business_database_employee_all = Source{[Schema="business_database",Item="employee"]}[Data],
    employee_included = . . . Return all rows from employee where employee.business_id = business.id . . .
in
    employee_included

如能对此提供任何形式的帮助,我们将不胜感激!我很想使用 Table.SelectRows,但如果有人推荐,我会使用更好的功能!

听起来您想过滤员工 table,以便它只显示 business_id 字段中与企业 table[=12= 匹配的行]

最好的方法是将业务table合并到员工table中,匹配business_id字段,使用inner join

#"Merged Queries" = Table.NestedJoin(#"PriorStepNameinEmployeeTable",{"business_id"},business,{"business_id"},"business",JoinKind.Inner)

另一种方式

#"Select" = Table.SelectRows(#"PriorStepNameinEmployeeTable", each Table.Contains(business_table,_,{"business_id"}))