Hi,
Can someone please help me to understand the below code. The idea of creating this code was if i am running the workflow in mid-quarter then last quarter end date should be populated, For example, if I am running the formula tool in Jan, Feb or Mar 2024 then 12/31/2023 date should get populated in the new column. It was happening as per expectations earlier, but now i see date as 12/31/2024 is getting populated. Can someone please help in this?
Formula :- if DateTimeFormat(DateTimeToday(),'%m') in ('10','11','12') then
datetimetrim(DateTimeAdd(DateTimeToday(),9-tonumber(DateTimeFormat(DateTimeToday(),'%m')),'months'),'lastofmonth') elseif
DateTimeFormat(DateTimeToday(),'%m') in ('07','08','09') then
datetimetrim(DateTimeAdd(DateTimeToday(),6-tonumber(DateTimeFormat(DateTimeToday(),'%m')),'months'),'lastofmonth')
elseif
DateTimeFormat(DateTimeToday(),'%m') in ('04','05','06') then
datetimetrim(DateTimeAdd(DateTimeToday(),3-tonumber(DateTimeFormat(DateTimeToday(),'%m')),'months'),'lastofmonth')
elseif
DateTimeFormat(DateTimeToday(),'%m') in ('01','02','03') then
datetimetrim(DateTimeAdd(DateTimeToday(),12-tonumber(DateTimeFormat(DateTimeToday(),'%m')),'months'),'lastofmonth')
else null()
endif