if Date.IsInYearToDate(Date.AddYears([Date], 2)) then "Yes"
else if Date.IsInYearToDate(Date.AddYears([Date], 1)) then "Yes"
else if Date.IsInYearToDate([Date]) then "Yes"
else "No"
Hello
I have a query that I need help improving. We have a date check that references a date we start 1/1/19 to current day. We use this date check to make sure that we don't keep anything that is more than 2 years ago and anything from after yesterday last year or 2 years ago from a sales report (We get this report daily) we use. Or that how it is supposed to be. the code currently brings in any sales last year or 2 years ago during the same day.
Ex what we have: todays date is 10/9/24 so in 2023 sales we are bringing in everything up to and including 10/9/24.
Ex what we want: todays date is 10/9/24 we want all sales up to and including yesterday 10/8/24. Same for 2022.
My thinking is to do date.currentlocaltime and do a dateadd.day -1 to that but I can't seem to figure it out. We still don't want any over 2 years ago so right now anything 12/31/21 and before.
Thanks!