cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FarhadA
Regular Visitor

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
Super User
Super User

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
Super User
Super User

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
Super User
Super User

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.






Thank you, 

 

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

FarhadA
Regular Visitor

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

FarhadA_0-1652807063721.png

 

amitchandak
Super User
Super User

@FarhadA , You need to create measures for that

 

example

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



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors