Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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()))
like image 796
Kholt69 Avatar asked Nov 03 '25 03:11

Kholt69


1 Answers

You can do that also in UI.

If your column if type date: enter image description here

enter image description here

Then when you look into Advanced Editor (or formula bar) you will see that Power Query has dedicated function for that:

#"Filtered Rows" = Table.SelectRows(#"Changed Type", each Date.IsInPreviousNDays([Column1], 60))
like image 164
Michal Palko Avatar answered Nov 06 '25 04:11

Michal Palko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!