在Power BI中使用DAX进行过滤

时间:2020-08-17 09:15:24

标签: powerbi report powerquery

我正在尝试使用Power BI中的DAX度量进行过滤。我在DAX公式中有一个国家列表,我想返回英国和法国

Country
United Kingdom
France  
Germany
Turkey
South Africa
Ghana
Nigeria
Australia
New Zealand
Fiji
Solomon Islands
Canada
United States
India 
Mexico
Brazil
China

我的DAX是

ListCountry = CALCULATE(MAX(Orders[Country]),FILTER(Orders,Orders[Country]="France" || Orders[Country] ="United Kingdom"))

当我对其进行测试时,它仅返回United Kingdom 但是我想要的是显示

United Kingdom
France

1 个答案:

答案 0 :(得分:1)

它仅返回United Kingdom,因为您正在计算MAX值(MAX(Orders[Country]))。在这种情况下,过滤器将返回FranceUnited Kingdom,后一个是最大值。否则,过滤器将返回您期望的结果:

Table = FILTER(Orders, Orders[Country] = "France" || Orders[Country] = "United Kingdom")

enter image description here