Forum Discussion

gdssiqueira's avatar
gdssiqueira
Helper I
10 years ago
Solved

Filter on two conditions

Hi guys,

 

I want to filter a table by two values.

Suppose I have this schema:

 

Date  A

1/1    12

2/1    15

3/1    12

 

I want to remove rows in which (A < 15 AND the date is older than 3 days ago.) If it's less then 3 days ago, keep it, no matter what the value of A is.

 

What would you say is the best way to accomplish this?

 

Thanks!

  • In Edit Query:

     

    = Table.SelectRows(#"Tipo cambiado", each ([Date] >= Date.AddDays(Date.From(DateTime.LocalNow()),-3)or [Value] >= 15) or [Date] >= Date.AddDays(Date.From(DateTime.LocalNow()),-3))

     

     

2 Replies

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    In Edit Query:

     

    = Table.SelectRows(#"Tipo cambiado", each ([Date] >= Date.AddDays(Date.From(DateTime.LocalNow()),-3)or [Value] >= 15) or [Date] >= Date.AddDays(Date.From(DateTime.LocalNow()),-3))

     

     

    • ridhwaanmayet's avatar
      ridhwaanmayet
      Frequent Visitor

      Is there a way of running an OR conditional filter outside of a query? My case is as follows:

       

      I have a report which requires conditional filters for some pages and not for others.

      The conditional filter is as follows Column 1: contains "XXX" OR column 2: contains "YYY".

       

      I understand I can create a query in the "Edit Queries" funtion to achieve this. My problem is that I need to use the same table without the queries on other pages of the same report. As far as I can see I need to create a duplicate sheet and then run the query on this sheet.

       

      Is there an easier way?