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
TTL
New Member

How to show 2 filters with OR condition

Hello,

 

I have 2 filters (image below) for my table. 

TTL_0-1686775943804.png

 

However, when both are applied, the table only shows rows that fits filter 1 AND filter 2. 

How can I make it so that it shows rows that fit either filter 1 OR filter 2?

 

Thank you!

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @TTL 

According to your description, you want to make your two filter as OR logic.

In the default Filter pane, the default filtering logic is AND. If we want to filter OR for one of our visual objects, we can try to create a metric for inventory to filter.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1686880493385.png

(2)We can create a measure like this:

Measure = var _diff1= MAX('Table'[Diff1])
var _diff2 = MAX('Table'[Diff2])

return
IF( OR(  _diff1 <-0.5 || _diff1 >1 ,  _diff2 <-0.5 || _diff2 >1 ) ,1,0)

Then we can put this measure on the "Filter on this visual" and then we can meet your need.

vyueyunzhmsft_1-1686880533101.png

 

And you can also replace the "0.5/1" number to the parameter as a slicer to put in , for this you can refer to :
Use parameters to visualize variables - Power BI | Microsoft Learn

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @TTL 

According to your description, you want to make your two filter as OR logic.

In the default Filter pane, the default filtering logic is AND. If we want to filter OR for one of our visual objects, we can try to create a metric for inventory to filter.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1686880493385.png

(2)We can create a measure like this:

Measure = var _diff1= MAX('Table'[Diff1])
var _diff2 = MAX('Table'[Diff2])

return
IF( OR(  _diff1 <-0.5 || _diff1 >1 ,  _diff2 <-0.5 || _diff2 >1 ) ,1,0)

Then we can put this measure on the "Filter on this visual" and then we can meet your need.

vyueyunzhmsft_1-1686880533101.png

 

And you can also replace the "0.5/1" number to the parameter as a slicer to put in , for this you can refer to :
Use parameters to visualize variables - Power BI | Microsoft Learn

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thank you Aniya! Nice Anya icon 😄

vicky_
Super User
Super User

If you need OR filters, you can't use the filter pane to acheive that. This article goes into more details on how to use DAX to get OR conditions: https://apexinsights.net/blog/or-xor-slicing

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.