cancel
Showing results for
Did you mean:
Frequent Visitor

## 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
Frequent Visitor

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

Frequent Visitor

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

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

#### Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

#### Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (74,718)