Adding days to a date field

Hi

I am trying to add a number of days (shift the date) to a ‘Payment Date’ field. The number of days to add / shift depends on what day of the week the ‘Payment Date’ is. For example if the payment date was a Thursday (day = 5) or a Friday (day = 6), then I would like to add 4 days to the ‘Payment Date’. For all other days I would only like to add 2 days.

An Excel equivalent looks something like this:
=IF(WEEKDAY(P2)=5,P2+4,IF(WEEKDAY(P2)=6,P2+4,P2+2))

Can this be done. Any help would be appreciated.

Thanks
Chris

This is my attempt using the column expression node:

if (column(“Day of week (number)”) == 5)
{if (column(“Day of week (number)”) == 6)
{plusTemporal(column(“Payment Date”),periodOfDays(4) )}
else
{plusTemporal(column(“Payment Date”),periodOfDays(2) )}}

but it seems to be adding 2 days when the day of week is either 5 or 6, whereas I would like it to add 4.

Not sure where I am going wrong…

Try this.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.