Search code examples
datepowerquerydate-rangemdate-difference

Power Query filter date from today minus ? days to today


I'm just learning Power Query and trying to figure out how modify a filter to return data within a dynamic date range. E.g. from Today - 60 days to Today Here's the code, any help much appreciated.

= Table.SelectRows(#"Changed Type", each [Start] >= Date.AddDays(DateTime.Date(DateTime.LocalNow())-60) and [Start] <= DateTime.Date(DateTime.LocalNow()))

Solution

  • = Table.SelectRows(#"Changed Type", each [Start] >= Date.AddDays(Date.From(DateTime.LocalNow()),-60) and [Start] <= Date.From(DateTime.LocalNow()))