简体   繁体   中英

Filter with DAX in power BI

I am trying to filter with a DAX measure in power BI. I have a list of countries by in my DAX formula I want to return United Kingdom and France

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

My DAX is

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

When I test it it returned only United Kingdom BUT what I want is display

United Kingdom
France

It returns only United Kingdom , because you are calculating the MAX value ( MAX(Orders[Country]) ). In this case, the filter returns France and United Kingdom , and the later one is the maximum value. Otherwise the filter returns what you expect:

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM