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
Anonymous
Not applicable

Using OR to filter a visual using two fields

Hi,

 

I am trying to filter a visual based on two fields but at the moment once the first one is applied the 2nd is restricted. 

 

I want the table to list values when either SOS = 22/23 OR PC = 22/23

FarhadA_0-1652801923415.png

 

At the moment once a select the first then the second is select is reduced. 

 

These are Dax calender tables.

 

Any help is much appricated.

 

Thank You

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Here is one way. Create duplicates of the tables and leave them unrelated in the model. Use the fields of these unrelated tables as the slicers.

model.png

 

Then create the equivalent measure to use as a filter for the visual, setting the value to 1:

 

Filter Table =
SWITCH (
    TRUE (),
    AND (
        ISFILTERED ( PC ),
        MAX ( 'Table'[PC Format] ) IN VALUES ( PC[PC Format] )
    ), 1,
    AND (
        ISFILTERED ( SOS ),
        MAX ( 'Table'[SOS Format] ) IN VALUES ( SOS[SOS Format] )
    ), 1,
    AND ( NOT ( ISFILTERED ( PC ) ), NOT ( ISFILTERED ( SOS ) ) ), 1
)

 

FT.gif

 

I've attached a sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

Can you try again? I actually edited the post and you may have tried while I was editing it

EDIT: I just tried the download and it works for me





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

Here is one way. Create duplicates of the tables and leave them unrelated in the model. Use the fields of these unrelated tables as the slicers.

model.png

 

Then create the equivalent measure to use as a filter for the visual, setting the value to 1:

 

Filter Table =
SWITCH (
    TRUE (),
    AND (
        ISFILTERED ( PC ),
        MAX ( 'Table'[PC Format] ) IN VALUES ( PC[PC Format] )
    ), 1,
    AND (
        ISFILTERED ( SOS ),
        MAX ( 'Table'[SOS Format] ) IN VALUES ( SOS[SOS Format] )
    ), 1,
    AND ( NOT ( ISFILTERED ( PC ) ), NOT ( ISFILTERED ( SOS ) ) ), 1
)

 

FT.gif

 

I've attached a sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thank you, 

 

I tried to downloand the file but that doesn't seem to work, are you able to reupload it?

Anonymous
Not applicable

I'm unable to call the date table as they are Dax tables

FarhadA_0-1652807063721.png

 

amitchandak
Super User
Super User

@Anonymous , You need to create measures for that

 

example

countrows(filter(Table, Table[SOS] = "22/23" || Table[PC] = "22/23"))

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.