Search code examples
powerbireportpowerquery

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

Solution

  • 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")
    

    enter image description here