cancel
Showing results for
Did you mean:
Helper I

## Dayofyear expression to exclude holidays

Hello all,

I have a flow that is triggered by an email and results in a task being created in microsoft planner.  The 'startdate' for the task is the same day that task is created (utc(Now)) and the 'duedate' is set for 2 days from the startdate.  I pulled a formula elsewhere on the web that has successfully excluded weekends from the duedate calculation using a couple of initialize variable steps.  I am now searching for a formula to use that will exclude holidays.  My company observes 11 holidays in the US.  I was wondering if I might be able to use the dayofyear expression to exclude those 11 holidays?

Here are some snips of the flow:

Thank you all for your help!

Brett

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @bgoldberger :

Do you want to get the date two days after the current date (and exclude weekends and weekdays).

Firstly,I am afraid that dayofyears cannot meet your requirements, because it is impossible to 100% determine the day of the year for a certain holiday.

Refrenence Expression:
1\

``````[
{
"Date": "2021-1-1"
},
{
"Date": "2021-1-18"
},
{
"Date": "2021-2-15"
},
{
"Date": "2021-5-31"
}
]``````

/*Need to list all holidays*/

2\

3\
4\
5\
6\
7\
8\
The Result:
Because I was doing the test on December 30, there was a New Year’s Day and a weekend in between, so the final result was January 4
Best Regards,
Bof
4 REPLIES 4
Community Support

Hi @bgoldberger :

Do you want to get the date two days after the current date (and exclude weekends and weekdays).

Firstly,I am afraid that dayofyears cannot meet your requirements, because it is impossible to 100% determine the day of the year for a certain holiday.

Refrenence Expression:
1\

``````[
{
"Date": "2021-1-1"
},
{
"Date": "2021-1-18"
},
{
"Date": "2021-2-15"
},
{
"Date": "2021-5-31"
}
]``````

/*Need to list all holidays*/

2\

3\
4\
5\
6\
7\
8\
The Result:
Because I was doing the test on December 30, there was a New Year’s Day and a weekend in between, so the final result was January 4
Best Regards,
Bof
Helper I

Wow, this is fantastic and thanks so much for your help.  I can tell this will function just as I was hoping for.  The output from the compose function should work for my due date in planner.  But for whatever reason, the flow keeps timing out at the do until step.  I've tried throwing in a couple of delays to see if that will work but it isn't getting pushed through.  Maybe this is just temporary?  Let me know if you might have any suggestions.  Thank you!

Flow triggered by email:

Community Support

Hi @bgoldberger :

There is a problem with the 'condition' action:

I have marked the error:

The correct setting is

Best Regards,

Bof

Helper I

That was certainly it!  I've been working on this the past week and this really helps.  Thanks again and happy new year.

Brett

Announcements

#### 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.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors
Users online (1,474)