Forum Discussion
smithmc3
Advocate I
9 years agoQuery Editor date filtering
I am trying to filter a column based on date and I only care about the records that are equal to or less than two years old
- 9 years ago
Hi smithmc3,
Please refer to the steps below.
- Select any date when filter data and click OK button.
- Change the date #datetime(2017, 3, 16, 0, 0, 0) to Date.AddDays(DateTime.LocalNow(),-730))
Regards,
Charlie Liao
Ignacio_Vidal
9 years agoFrequent Visitor
For all the people having problems with "we cannot apply < operator to types date and datetimezone", you are comparing Dates and DateTimes. As the original answer gives a DateTime, you must convert it to Date.
This can be accomplished adding a Date.From function before the DateTime.LocalNow() one. The original answer wolud be transformed to:
"> Date.AddDays(Date.From(DateTime.LocalNow()), -730))"