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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
njg
Frequent Visitor

Slicer with AND condition in Power BI instead of OR

Hello, the default behaviour of the slicer in Power BI is that it shows the result of OR when you select multiple items. For example, if you have a slicer for software, and then you select both “AutoCAD" and "Revit" the result would list the staff that know "Revit" OR "AutoCAD".  I would like to see the list of staff who know both "Revit" AND "AutoCAD".  I have found the answer to this a couple of different ways by googling it, but, I am embarassed to say i don't understand the solutions.....i am hoping for a severely simplified answer if possible.

1 ACCEPTED SOLUTION
Jeanxyz
Impactful Individual
Impactful Individual

Thanks for sharing this Dax formula. 

 

Here is the modified version,

 

Measure with and-only condition =
var selectedProduct=values(dim_Product)
var countRowsFact=countrows(distinct(filter(fact_product,related(dim_product[Fruit]) in selectedProduct)))
var countRowsProduct=countrows(selectedProduct)
return
if(countRowsFact>=countRowsProduct,countRowsFact,blank())
 
Please make sure there is relationship between Dim_Product and Fact_Product Table. The measure works on my side. 
 
slicer with and condition.PNG
 

View solution in original post

13 REPLIES 13
Anonymous
Not applicable

Hello,

I apologize for posting on a topic that has already been resolved. However, I am in need of your assistance. I have arrived at this place with the same problem, but I am getting the following error even after creating the same situation that can be confirmed.

I have established a many-to-many relationship between dim_product[Fruit] and fact_product[Fruit], but do you know what is missing?

D_taro_0-1684452090822.png

 

dim_product

D_taro_1-1684452141696.png

 

fact_product

D_taro_2-1684452178883.png

 

relationship

D_taro_3-1684452251968.png

 

njg
Frequent Visitor

Hi, does this help?

njg_0-1684454485752.png

If not, I can get you more info when i am back on may 24th (can's show my 'real' data, but can make up the Apple, pear, banana one again easy enough)

Anonymous
Not applicable

Thank you for your response. However, in my environment, it is not possible to have many-to-one or one-to-many relationships, even though many-to-many relationships are possible. Thank you for taking the time to help me, and I look forward to your return to your home country.

 

D_taro_1-1684460383067.png

 

 

Anonymous
Not applicable

Thank you for your help with my previous inquiry regarding Power BI. I was able to resolve the issue on my own. The problem was that the dim_product[Fruit] column had multiple entries for each of the fruits (Apple, Banana, Pear). By consolidating them into individual entries, I was able to establish a many-to-one relationship. Your assistance was greatly appreciated. Thank you so much.
njg
Frequent Visitor

Hi, I am glad you were able to resolve it.....I see in your first post that if i had paid better attention i would have caught that for you....will do better next time 🙂

Jeanxyz
Impactful Individual
Impactful Individual

Thank you for accepting the solution. I have so far mostly using the community to post my questions. Your feedback will encourage me to offer more solutions in future. 

njg
Frequent Visitor

Hi, thank you so much for your time, but i am still a bit stuck (and you did a wonderful amazing job of keeping it simple for me).....i got this error message:

njg_0-1661209028369.png

I created a 'many to many' relationship between these two tables 'fruit to fruit' (it wouldn't let me do a 'one to many' or a 'many to one')

njg_1-1661209161680.png

my two tables look like this

njg_2-1661209259937.png

njg_3-1661209300303.png

and the fields are set up like this

njg_4-1661209343772.png

I just know i am soooo close to having this right, really, really appreciate your help!

 



MahyarTF
Memorable Member
Memorable Member

Hi,

As I understand, you want to see the staffs who have experience in Autocad and Revit,

you could use Table Visual on the same page and as you filter your slicer on both values, there is the staff with whatever you want.

another way, in the particular visual or page, you could put the specific column (has experience title as Autocad, Revit,...) in your filter pane

MahyarTF_0-1659657696760.png

 

Mahyartf
njg
Frequent Visitor

Hi, thank you for your reply, but this is not what I am looking for (my fault, i did not supply enought information)
Here is a sample table:

njg_0-1659719474531.png

When I use the slicer to select Apple and Banana, i would like it to only show those who have BOTH Apples and Bananas, currently it shows those who have Apples OR Bananas

njg_1-1659719585315.png

I am hoping for Bobby to not show up since he does not have both apples AND bananas

MahyarTF
Memorable Member
Memorable Member

Hi,

not sure if it is useful for you :

- I create another DAX table as below : 

Sheet63Table =
             SUMMARIZECOLUMNS(Sheet63[Name],
--                                "Expeience-Complete", CONCATENATEX(Sheet63, Sheet63[Experience] &", "),
                                "ExpeienceConcatCol", left(CONCATENATEX(Sheet63, Sheet63[Experience] &", "), len(CONCATENATEX(Sheet63, Sheet63[Experience] &", "))-2)
                                )

MahyarTF_0-1659911880723.png

- then create relation between new table and existing one :

MahyarTF_1-1659911921660.png

- then use the particular column as a slicer and table visual :

MahyarTF_2-1659912090199.png

 

Mahyartf
njg
Frequent Visitor

Hi, Thank you for your help, but it's still not quite what i am hoping for.  Please see my 'apple, banana'pear' scenario above.....do you know how i would adapt this DAX to work in that scenario?

njg_0-1661198230898.png

 

 

Jeanxyz
Impactful Individual
Impactful Individual

Thanks for sharing this Dax formula. 

 

Here is the modified version,

 

Measure with and-only condition =
var selectedProduct=values(dim_Product)
var countRowsFact=countrows(distinct(filter(fact_product,related(dim_product[Fruit]) in selectedProduct)))
var countRowsProduct=countrows(selectedProduct)
return
if(countRowsFact>=countRowsProduct,countRowsFact,blank())
 
Please make sure there is relationship between Dim_Product and Fact_Product Table. The measure works on my side. 
 
slicer with and condition.PNG
 
njg
Frequent Visitor

YAY!  THANK YOU, THANK YOU, THANK YOU!  It works beautifully.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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