Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter out dates after today's date

I'm trying to remove future dates from my table.

I tried the below m query which errors, saying the operator 'not' cannot be applied to type DateTime:

 

 

= Table.SelectRows(PreviousStep, each not [Received Date] > DateTime.LocalNow())

 

 

Any suggestions? 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hello Anonymous,

    Create a column Like this,

    TillToday1 = IF([Date]<=TODAY(),1,0)
     and pass this column as filter to page/visual or all pages in which level you would like to filter the date.
    and select 1.
     

     

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello Anonymous,

    Create a column Like this,

    TillToday1 = IF([Date]<=TODAY(),1,0)
     and pass this column as filter to page/visual or all pages in which level you would like to filter the date.
    and select 1.
     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    or you can try below m query to filter the future dates

     

    = Table.SelectRows(#"Changed Type", each [Date] <= Date.From(DateTime.LocalNow()))

  • Anonymous's avatar
    Anonymous
    Not applicable
    = Table.SelectRows(Kept24months, each not ([Received Date] > DateTime.LocalNow()))
    or
    = Table.SelectRows(Kept24months, each [Received Date] <= DateTime.LocalNow())