Forum Discussion
joshua1990
6 years agoPost Prodigy
Filter Date Column by TODAY-7
Hello everyone! I have a date column that I would like to filter on all dates 7 Days before today. Is there any chance to determine that with Power Query?
- 6 years ago
Hi joshua1990 ,
You could try below M code
let Source = List.Dates(#date(2020,4,12), 30,#duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each if [Column1]<=DateTime.Date(DateTime.LocalNow())-#duration(7,0,0,0) then 1 else 0), #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = 1)) in #"Filtered Rows"Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
6 years agoCommunity Champion
Yes, it is DateTime.LocalNow I believe. https://www.powerquery.io/date-time/datetime.localnow