'How to make a date dynamic in Dynamics based on the day of the week

I want to have a date that takes another date and subtracts 2 days from it, but if that "subtracted 2 days" date lands on a weekend, it gets moved to a weekday.

For example, one date is 4/5/22 so then the date that I want to be dynamic would be 4/3/22 (-2 days) which is a Sunday. I want this date to then be moved to Monday automatically. If it had landed on a Saturday, I want the date to move to a Friday. I have tried to use a reference date, but I am not able to set a reference date in the calculated field for a column.

This was my reference for attempting this https://community.dynamics.com/crm/b/leontribe/posts/calculating-the-day-of-the-week-without-code. I was just trying to get days of the week, and then from there do my calculated date.

I get this error trying to set a date Reference Date Error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source