Jun 04, 2023 04:12 AM
Hello everyone,
I have currently the following formula in my table that shows "Yes" if the date in "Fin contrat" is in a future month. I am trying, but with no success, to adapt this formula to show "Yes" in another column if the same date is in the previous year (so currently 2022).
Can someone please help me achieve this?
Thanks! 🙂
IF(
IS_AFTER(
{Fin contrat},
DATEADD(
DATEADD(
DATETIME_PARSE(
"01 " & DATETIME_FORMAT(
TODAY(),
"MM YYYY"
),
"DD MM YYYY"
),
"1",
"months"
),
"-1",
"days"
)
),
"Yes",
"No"
)
Solved! Go to Solution.
Jun 04, 2023 07:00 AM
Hi @ClarenceK,
You could adapt this formula to something like:
IF(
IS_BEFORE(
{Fin contrat},
DATETIME_PARSE('1/1/' & YEAR(NOW()))
),
'Yes',
'No'
)
*but this would be 'yes' for all previous years, not just last year.
If you want to check if a date's year = last year, you could do:
IF(
YEAR({Fin contrat}) = YEAR(DATEADD(NOW(),-1, 'year')),
'Yes',
'No'
)
Hope that helps!
-Stephen
Jun 04, 2023 07:00 AM
Hi @ClarenceK,
You could adapt this formula to something like:
IF(
IS_BEFORE(
{Fin contrat},
DATETIME_PARSE('1/1/' & YEAR(NOW()))
),
'Yes',
'No'
)
*but this would be 'yes' for all previous years, not just last year.
If you want to check if a date's year = last year, you could do:
IF(
YEAR({Fin contrat}) = YEAR(DATEADD(NOW(),-1, 'year')),
'Yes',
'No'
)
Hope that helps!
-Stephen
Jun 04, 2023 08:01 AM
That's perfect, thank you very much @Stephen_Orr1!