Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

date interval ('>', '<')

Hi,

how can I add a filter with this kind of condition

date1 > 2022-03-31 and date2 < 2022-03-31

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Where would you like to use it?

     

    1. You can add a filter to visuals, current page, and all pages.

    Add a filter to a report in Power BI - Power BI | Microsoft Docs

     

    2. You can also create two slicers and drag the two date columns into the slices.

    Slicers in Power BI - Power BI | Microsoft Docs

     

    3. In a formula, you can add code like this in place of the filter parameter of the formula, e.g.

    Measure =
    CALCULATE(
    SUM('Table'[Value]),
    FILTER(ALL('Table'),'Table'[Date1]>DATE(2022,3,31)&&'Table'[Date2]<DATE(2022,3,31))
    )

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

4 Replies

  • Anonymous ,

    Try like 

    filter(Table, Table[Date1] >date(2022,3,31) && Table[Date2] < Date(2022,3,31) )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks amitchandak 

      is it a DAX measure ? sorry to ask basic question but how can I implement it to have the filter in the dashboard/report?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        Where would you like to use it?

         

        1. You can add a filter to visuals, current page, and all pages.

        Add a filter to a report in Power BI - Power BI | Microsoft Docs

         

        2. You can also create two slicers and drag the two date columns into the slices.

        Slicers in Power BI - Power BI | Microsoft Docs

         

        3. In a formula, you can add code like this in place of the filter parameter of the formula, e.g.

        Measure =
        CALCULATE(
        SUM('Table'[Value]),
        FILTER(ALL('Table'),'Table'[Date1]>DATE(2022,3,31)&&'Table'[Date2]<DATE(2022,3,31))
        )

         

        Best Regards,
        Gao

        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

        How to get your questions answered quickly -- How to provide sample data