Hi @Renae_Jording
I’m pretty sure there could be better way to do this but I sadly don’t have much time right now …
How about this though :
SwitchIf(
thisRow.Occurrence = Daily,
thisRow.[Due Date].Workday(1),
thisRow.Occurrence = Weekly,
thisRow.[Due Date].Workday(7),
thisRow.Occurrence = Monthly,
If(
thisRow.[Due Date].RelativeDate(1).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
thisRow.[Due Date].RelativeDate(1),
thisRow.[Due Date].RelativeDate(1).Workday(1)
),
thisRow.Occurrence = [3 Months],
If(
thisRow.[Due Date].RelativeDate(3).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(3).Weekday() != 7,
thisRow.[Due Date].RelativeDate(3),
thisRow.[Due Date].RelativeDate(3).Workday(1)
),
thisRow.Occurrence = [6 Months],
If(
thisRow.[Due Date].RelativeDate(6).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(6).Weekday() != 7,
thisRow.[Due Date].RelativeDate(6),
thisRow.[Due Date].RelativeDate(6).Workday(1)
),
thisRow.Occurrence = Yearly,
If(
thisRow.[Due Date].RelativeDate(12).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
thisRow.[Due Date].RelativeDate(12),
thisRow.[Due Date].RelativeDate(12).Workday(1)
)
)
It is not very pretty to look at but it seems to work in your doc (which I didn’t modified though )
Each Monthly
, 3 months
… Occurences conditions of your SwicthIf()
I ask the formula to check first (with a simple If()
) if the next due day is not a Sunday
(Weekday != 1
) or a Saturday
(Weekday != 7
) …
If this is True
, the If()
returns :
thisRow.[Due Date].RelativeDate(1)
I.e.: The Due Date
+ 1 month
else, it returns :
thisRow.[Due Date].RelativeDate(1).Workday(1)
I.e.: The working day coming after the Due Date
+ 1 month
You could also choose the previous working day by using this (for the else
part of the If()
), instead :
thisRow.[Due Date].RelativeDate(1).Workday(-1)
In its entirety, the part regarding your Monthly
occurence looks like this :
SwitchIf(
[ ... ]
thisRow.Occurrence = Monthly,
If(
thisRow.[Due Date].RelativeDate(1).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
thisRow.[Due Date].RelativeDate(1),
thisRow.[Due Date].RelativeDate(1).Workday(1)
)
[ ... ]
)
I’m sorry I can’t do much more right now, but I hope this helps