Forum Discussion

jtomczyk's avatar
jtomczyk
Helper I
4 years ago
Solved

Date Filter in Power Query

Hallo,  I would like to have one button to remove all projects that were done in last 30 days. To do that I have added new conditional column in power query. I do not know why it doesn't work. Any ...
  • v-yalanwu-msft's avatar
    4 years ago

    Hi., jtomczyk ;

    Because your [Date] column is in Date format and date.adddays (datetime.localnow (), -30) returns Date/Time format, the two formats are not comparable in power Query, so you cannot use <;

    so we could change the Date column to Date/Time format . then compare them.

    = Table.AddColumn(#"Changed Type1", "Custom", each if [Date]<Date.AddDays(DateTime.LocalNow(),-30) then "Wrong" else "Correct")

    Or change the other column to Date format.


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