Hi,
Let's ignore the email for a moment.
1. Create a Variable that will store the Date, that you finally want to use after you have verified its 1-5 day of week or 0,6
Since this date will be the date you want to leverage in your code after.
To find out what day it falls on, you use the dayOfWeek(date) expression. Which you have, but you should swap it so that the Yes part is Monday - Friday, not that the yes part is Saturday or Sunday
Sunday = 0
Saturday = 6
So, if the answer is 1-5 then its in the day of the week so your condition would be
Left side Expression above using your date 3 days back,
middle = great than or eq to
right side 1
Add another expression to the condition and make it an And
Expression above using your date 3 days back,
middle = less than or eq to
right side 5
1a) In your Yes Side, it means it was 1-5. So use the Set Variable action to set the Variable you created at the top, so now you have your date to use going forward. In this case its exactly the date you created when you subtracted 3 days.
So to now answer you as to how it moves on.
1b) In the No Side (0 or 6) and you need to calculate how many days you need to "subtract from either 0 or 6, to make it Friday, which was your ask"
Then you want to use THAT integer value to subtract more days from your already existing 3 day removed Date.
So... you add a Compose
in the compose you will like this
if(equals(dayorweekvalue, 0, 2), 1)
Now what this does is, if its Sunday (0) you need to subtract 2 MORE days from your 3 day already subtracted, or subtract 5 from the original date. If its not 0 then we know its 6 in which case its Saturday and we need to subtract 1 more day from your 3 day already subtracted, or subtract 4 from the original date
After the compose use the Set Variable to set the date
In the expression you need to do something like
addDays(body('Get_item')?['ResponseDue'], -(3 + int(Outputs(YourCompose)));
This way, it takes your original 3 days, adds the output of the previous step and THEN subtracts it.. And it will always be friday.
now outside of the Condition, you continue on all happy because the Variable has your proper Date.
and done.