cancel
Showing results for
Did you mean:
Helper II

Hello people,

I need some help on this point, I have a flow in which it receives a date and a day as a result show the date plus the amount of days but now I need to exclude weekends from the result

This is my formula that works perfectly, however, this includes weekends and I would like to take weekends out

``adddays(outputs('Set_Start_Date'),add(int(items('Apply_to_each')?['Day']),int(1)))``

8 REPLIES 8
Super User III

You'll want to use the dayOfWeek() expression and apply it to the date that you have calculated.  dayOfWeek returns 0 for Sunday and 6 for Saturday.  So, you might, for example, add one more day if the result is 0 and two days if the result is 6.

You could do all of this in a single expression, but it would be really ugly - I would divide it into two or three expressions probably inside of Compose actions.

Let me know if you need more help.

If you like my response, please give it a Thumbs Up.

Scott
Helper II

I'm a beginner in Power Automate, what would be the expression using IF could you please guide me on this

Thanks Mr. @ScottShearer

Solution Sage

To use Day of week :

dayOfWeek(variables('Date')) : Replace variables('Date') with your variable

Thanks

Super User III

Please see my screen shot below.  A Switch action is appropriate here.

If you like my response, please give it a Thumbs Up.

Scott
Helper II

Im trying to emulate your flow but is showing a error

Helper II

This is my currently flow

Solution Sage

Where are you using the Dayofweek functionality in the screenshots you mentioned. Also where you are getting the error what variable are you using to get the output in switch.

Thanks

Super User III

My suggestion is as follows

1. Create a string variable near the top of your Flow
2. In the Switch statement/action, use your current expression inside of a dayOfWeek() expression
3. The cases should be 1, 6 and the default case.  The numbers 1 and 6 represent Saturday and Sunday.
4. In the case section of the Switch action, add 0, 1 or 2 days to the output of your expression as appropriate and store the result in the variable that you initialized.
5. When updating the SharePoint item, set the Actual end date column equal to the variable

If you like my response, please give it a Thumbs Up.

Scott

Announcements

Check out the new Process Advisor community forum board!

#### Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,280)