Forum Discussion

Jack2710's avatar
Jack2710
Frequent Visitor
2 years ago

OR condition within slicers

Hi Everyone,

I want to get selected date data available in three different date slicers in power-bi, but it is using AND condition I need OR condition.
All three date columns are from one table
Ex :

idcatcreate dateresolve datetarget date
1aa1/8/20241/8/20241/8/2024
2ee1/7/20245/8/20247/1/2024
3dd1/6/20241/8/20246/8/2024
4zz1/9/20241/10/20246/9/2024
5yy1/10/20241/8/20246/9/2024
6xx1/21/20244/8/20241/8/2024

 
If I select 1/8/2024 date for  Create date, Resolve date, target date , it should give the below result 

idcat
1aa
3dd
5yy
6xx



Using columns are 
1. Create date
2. Resolve date
3. target date

Thanks in advance.

3 Replies

  • Jack2710 , Create a date table using the calendar function, and do not join that with any of the dates

     

    Create a measure like

     

    countrows(filter(Table, Table[create date] in values(Date[Date]) || Table[resolve date] in values(Date[Date]) || Table[target date] in values(Date[Date]) ))

    • Jack2710's avatar
      Jack2710
      Frequent Visitor

      amitchandak Not working, created calendar and used the query as mentioned, 0 records retrieved.
      Thank you for your help

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Jack2710 ,

    Thank amitchandak  for his reply, I have some ideas to help you with your problem, you can follow the steps below:
    1.Add a new data table include all dates.

    data table = 
    CALCULATETABLE ( CALENDAR ( DATE ( 2024, 1, 1 ), DATE ( 2024, 12, 31 ) ) )
    

    2.Add a new measure.

    SelectedDateMatch = 
    IF (
        SELECTEDVALUE ( 'data table'[Date] )
            IN VALUES ( 'Table'[create date] )
                || SELECTEDVALUE ( 'data table'[Date] )
                    IN VALUES ( 'Table'[resolve date] )
                        || SELECTEDVALUE ( 'data table'[Date] ) IN VALUES ( 'Table'[target date] ),
        1,
        0
    )
    

     3.Put the measure into filter.

    Final output:

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

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