从联合表中选择 PowerBI 变量

PowerBI variable selection from union tables

我有两个表,table1 和 table2。我在 PowerBI 中创建了这两个表的 'Union'。

table1
id   city   fruit         table
a1   NY     apple         table1
a2   NY     apple         table1
a3   NY     pear          table1
a4   MI     pear          table1
a5   MI     apple         table1
a6   MI     strawberry    table1
a7   TO     strawberry    table1
a8   TO     strawberry    table1
a9   TO     kiwi          table1

table2
id   city   fruit         table
a11  NY     rockmelon     table2
a12  NY     rockmelon     table2
a13  BJ     pear          table2
a14  BJ     pear          table2
a15  BJ     apple         table2
a16  LA     blueberry     table2
a17  LA     blueberry     table2
a18  PA     blueberry     table2
a19  PA     kiwi          table2

我想创建一个过滤器“filter1”,如果满足这些条件,它会获取所有行: table1中的“city”是“MI”,或者table2中的“fruit”是“blueberry”。 如果满足条件,则在“filter1”的下拉列表中将其命名为“Awesome”。

请您看看下面的措施是否方向正确,如何进行?谢谢。

filter1 = 
VAR
  table1 = FILTER('Union', 'Union'[table]="table1" && 'Union'[city]="MI")
VAR
  table2 = FILTER('Union', 'Union'[table]="table2" && 'Union'[fruit]="blueberry")

Awesome_test =

var 过滤器 1 = FILTER(union, union[city]= "MI" && union[table]="table1")

var 过滤器 2 = FILTER(union, union[fruit]= "blueberry" && union[table]="table2")

var filter3 = UNION(filter1, filter2)

RETURN 计算(MAX(联合[id]),filter3)

//然后将新的measure拉入filter,select所有包含a的,则只保留满足要求的。