Hi !
I created a column to identify if the "End Date" of a task belongs to one of the weeks below, based on the ISO numbers for each week of the year (1~52 or 53).
But I am facing an error due to the year, that I cannot overpass.
It is considering the pure number of a week in 2023 (e.g.: #49) as a week in future, because the actual week number in 2024 is less than that.
Please, can someone help me with it?
PAST: "End Date" week number < actual week number
THIS WEEK: "End Date" week number = actual week number
NEXT WEEK: "End Date" week number = actual week number +1
FUTURE: End "Date" week number = actual week number +2
Here is the actual formula I have that is running, depite the error from year:
"
{End Date},
IF(
AND(
YEAR({End Date}) = YEAR(TODAY()),
DATETIME_DIFF({End Date}, TODAY(), 'days') < 0
),
"PAST",
IF(
AND(
YEAR({End Date}) = YEAR(TODAY()),
VALUE(DATETIME_FORMAT({End Date}, 'W')) = VALUE(DATETIME_FORMAT(TODAY(), 'W'))
),
"THIS WEEK",
IF(
AND(
YEAR({End Date}) = YEAR(TODAY()),
VALUE(DATETIME_FORMAT({End Date}, 'W')) = VALUE(DATETIME_FORMAT(DATEADD(TODAY(), 7, 'days'), 'W'))
),
"NEXT WEEK",
"FUTURE WEEKS"
)
)
),
"No End Date"
)
I also tried this other formula, but it produces this error: "Sorry, there was a problem saving this field. Invalid formula. Please check your formula text."
"
IF(
{End Date},
IF(
YEAR({End Date}) < YEAR(TODAY()),
"PAST",
IF(
YEAR({End Date}) = YEAR(TODAY())
AND VALUE(DATETIME_FORMAT({End Date}, 'W')) < VALUE(DATETIME_FORMAT(TODAY(), 'W')),
"PAST",
IF(
YEAR({End Date}) = YEAR(TODAY())
AND VALUE(DATETIME_FORMAT({End Date}, 'W')) = VALUE(DATETIME_FORMAT(TODAY(), 'W'))
AND {End Date} >= TODAY(),
"THIS WEEK",
IF(
YEAR({End Date}) = YEAR(TODAY())
AND VALUE(DATETIME_FORMAT({End Date}, 'W')) = VALUE(DATETIME_FORMAT(DATEADD(TODAY(), 7, 'days'), 'W'))
AND {End Date} >= TODAY() + INTERVAL '1 WEEK',
"NEXT WEEK",
"FUTURE WEEKS"
)
)
)
),
"No End Date"
)
"Print of the result:

Thank you all in advance.