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
Maryann
Helper I
Helper I

Or Condition on filter

How can I allow the user to select what date they want to see the data filtered by , depending on 2 columns:

Select data where date A = value (or range) or Date B = value (or range)

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

Hi @Maryann ,

 

We can archieve your requirement in single visual if you mean the two columns are in the same table. Firstly we create two calculated table based on the two columns:

 

FilterColumnA = 
DISTINCT('Table'[Date A])

 

FilterColumnB = 
DISTINCT('Table'[Date B])

 

Then we create a measure to filter the visual:

 

isDataFiltered =
COUNTAX (
    'Table',
    IF (
        OR (
            [Date A] IN FILTERS ( 'FilterColumnA'[Date A] ),
            [Date B] IN FILTERS ( 'FilterColumnB'[Date B] )
        ),
        1,
        BLANK ()
    )
)

 

Then we can put it into the visual filter then set it is greater than zero.

 

13.PNG

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
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

6 REPLIES 6
v-lid-msft
Community Support
Community Support

Hi @Maryann ,

 

We can archieve your requirement in single visual if you mean the two columns are in the same table. Firstly we create two calculated table based on the two columns:

 

FilterColumnA = 
DISTINCT('Table'[Date A])

 

FilterColumnB = 
DISTINCT('Table'[Date B])

 

Then we create a measure to filter the visual:

 

isDataFiltered =
COUNTAX (
    'Table',
    IF (
        OR (
            [Date A] IN FILTERS ( 'FilterColumnA'[Date A] ),
            [Date B] IN FILTERS ( 'FilterColumnB'[Date B] )
        ),
        1,
        BLANK ()
    )
)

 

Then we can put it into the visual filter then set it is greater than zero.

 

13.PNG

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm new to powerbi, and I'm not sure exactly how to follow your instructions.

You said to "create two calculated tables"  -  Is that in Modeling -  New table? 

When I do that I get:    1 TABLE =    

(not sure where FilterColumnA goes)  

If you could provide more direction it would be appreciated.

thanks

sorry, i didn't realize you sent an attachemnt.  That helps alot.  You can disregard previous question. I'll let you know if I need help.

thanks

Hi @Maryann ,


How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yours works fine.   But mine does not. So I must not have something set correctly. Still working on it.

thanks

 

Thank you!  I'll try it out ,and reply later today.

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.