I am querying a table with the integer field 'day_of_year', which is the numeric version of the date. The data is agricultural and the users want to see data in-season. Therefore, I am trying to query data between the last occurrence of October 1st and today.
How can I create two variables that are always correctly assigned the day number of year for the most recent occurrence of October 1st (e.g., 274 for Oct 1st 2023) and the day of the last data reload (e.g., 307 for today).
if(day_of_year <= daynumberofyear(Today(0)), date(makedate(Year(Today()))+(day_of_year-1)), // if DOY <= today's DOY, assign date from current year date(makedate(Year(Today())-1)+(day_of_year-1))) // if DOY > today's DOY, assign date from last year as prediction_date,