Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dillard70
Regular Visitor

How to use two different fields in one filter

I would like to take two or more different fields and put them in one "advanced" filter with a "contains X or X".

 

For example, let's say I have a spreadsheet with 4 columns: unique name of a person, what make of car they drive (Chevrolet, Ford, Honda, etc.), what kind of motorcylce they drive (Honda, Harley, etc.), and what method of public transportation they use (bus, subway, Uber, etc.) In a pool of 1,000+, some people may have only one answer (only drive a car), some may have none (only walk), and some may have multiple (own a Ford car and Honda bike, does not use public transportation). 

 

What I want to do with this data is to be able to filter out people who don't own a specific response in each category, but allow for them to be "false" in one column, but "true" in another and still report. For example: I want to show anyone who owns a Chevy or Ford car, and/or a Harley bike, and/or takes the bus. So, if I filter out anyone who doesn't drive a Chevy or Ford car, the report will not show people who have a Honda car but do own a Harley bike. If I filter each of these values to only show who owns each of these specific responses, it will only show people who selected all three, and not those who only selected one or two but not all. 

1 ACCEPTED SOLUTION
th3h0bb5
Resolver II
Resolver II

DAX has an OR function. Use that to create boolean answers to whatever question you want to answer.

 

So for your example,  "I want to show anyone who owns a Chevy or Ford car, and/or a Harley bike, and/or takes the bus."

 

you can create True/False statements as filters combining AND and OR statements. So something along these lines:

 

(A = "Chevy" OR "Ford") OR (B = "Harley") OR (C = "Bus")

 

As long as one of these things is true, the whole statement will return TRUE. If you want to see people who have a Chevy or Ford and drive the bus, just change an OR to an AND:

 

(A = "Chevy" OR "Ford") AND (C = "Bus")

View solution in original post

1 REPLY 1
th3h0bb5
Resolver II
Resolver II

DAX has an OR function. Use that to create boolean answers to whatever question you want to answer.

 

So for your example,  "I want to show anyone who owns a Chevy or Ford car, and/or a Harley bike, and/or takes the bus."

 

you can create True/False statements as filters combining AND and OR statements. So something along these lines:

 

(A = "Chevy" OR "Ford") OR (B = "Harley") OR (C = "Bus")

 

As long as one of these things is true, the whole statement will return TRUE. If you want to see people who have a Chevy or Ford and drive the bus, just change an OR to an AND:

 

(A = "Chevy" OR "Ford") AND (C = "Bus")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.