“Is there a way to trigger Power Automate flow only once a month on the first working day, no matter what day it is?”
There’re already posts on trigger a flow on a specific day in a specific week in a month, or by the end of a month. What about another alternative in the form of a first weekday in a month? If the 1st is a weekday, send in on that day, but if it’s Saturday or Sunday, wait for Monday.
Start from 1st
The easiest situation would be if the 1st is already a weekday. You don’t have to evaluate anything, you just run the flow. Let’s add it as the first condition, and to make it shorter let’s reverse it – it’s the 1st day and it’s not Saturday nor Sunday.
Firstly, check that the day part from today’s date is 1.
equals(int(utcNow('dd')),1)
Secondly, check that the day is not Saturday.
not(equals(dayOfWeek(utcNow(),6)))
Thirdly, check that the day is not Sunday.
not(equals(dayOfWeek(utcNow(),0)))
Now combine it all together using the and(…) expression.
and(equals(int(utcNow('dd')),1),not(equals(dayOfWeek(utcNow(),6))),not(equals(dayOfWeek(utcNow(),0))))
Send it on 2nd if 1st was Sunday
The other situation that could happen is that 1st is on Sunday, therefore, the flow should be triggered on Monday.
Check if the day part of the date is 2.
equals(int(utcNow('dd')),2)
And at the same time the day is Monday, otherwise it’d trigger on every 2nd day.
equals(dayOfWeek(utcNow(),1))
Again, put it together using the and(…) expression.
and(equals(int(utcNow('dd')),2),equals(dayOfWeek(utcNow(),1)))
Send it on 3rd if 1st was Saturday
The last situation is if the 1st day was Saturday, in that case you want to send it on Monday 3rd. Following the same logic as before, check that the day is 3…
equals(int(utcNow('dd')),3)
…and the day is Monday.
equals(dayOfWeek(utcNow(),1))
Combining them together:
and(equals(int(utcNow('dd')),3),equals(dayOfWeek(utcNow(),1)))
Build the final trigger conditions
The conditions above covered all situations:
- If it’s the 1st day and it’s not Saturday and Sunday, run the flow
- If it’s the 2nd day and it’s Monday, run the flow as 1st day was Sunday
- If it’s the 3rd day and it’s Monday, run the flow as 1st day was Saturday
This time you must connect them with the OR(…) expression as it must always fit into one of the options:
or(
and(equals(int(utcNow('dd')),1),not(equals(dayOfWeek(utcNow(),6))),not(equals(dayOfWeek(utcNow(),0)))),
and(equals(int(utcNow('dd')),2),equals(dayOfWeek(utcNow(),1))),
and(equals(int(utcNow('dd')),3),equals(dayOfWeek(utcNow(),1)))
)
Add the @ before the expression and use it as a trigger condition.
Summary
You can trigger Power Automate flow on the first working day in a month if you check all the possible situations. If the 1st day is a working day, trigger the flow right away. The only situations when it should be delayed is if it’s Saturday or Sunday, in that situations you want to send it on Monday. Either Monday the 2nd or Monday the 3rd.
Awesome, Tom! Best Power Automate collection out there.
Hello Tom, would it be possible to modify this set up so that it only triggers on certain working days in the month instead of the 1st (for example: the 3rd or 4th working day in the month)? I’m interested to see if this is possible.
Thank you!
Hello Joseph,
there’s an article to do the same for up to 5th working day in a month, after that it gets a lot more complicated: https://tomriha.com/trigger-power-automate-flow-on-a-specific-working-day-up-to-5th/
When reading this I originally assumed you set the recurrence to trigger on 1st of the month, but am I right in thinking that if the 1st is a Saturday or Sunday it will trigger on the 1st, assess the conditions and then because it is not a Monday it will exit, then not trigger again until the 1st of the following month? So essentially only running the full flow if 1st is a Monday?
I now presume you need the recurrence to be daily, then when one of the conditions is true (only one can be true per month) it will then trigger the full flow? Appreciate your clarification.
Hello Chris,
it’s exactly as you described, daily recurrence in the trigger and the condition will let it run only once per month.
This bit of code is exactly what I have been looking for, however when attempting to run as a trigger it generates an error: Cannot read properties of undefined (reading ‘properties’)
Cope copy and pasted exactly as above.
The following trigger to run on specific days works fine: @or(equals(utcNow(‘dd’), ’01’),equals(utcNow(‘dd’), ’15’),equals(utcNow(‘dd’), ’16’),equals(utcNow(‘dd’), ’30’),equals(utcNow(‘dd’), ’31’))
Any idea why your code would generate the error?
Hello Keith,
I don’t think it’s the trigger’s fault as it doesn’t read properties of anything, I’d try to move the trigger into a ‘Compose’ action after the trigger to check if still returns the value and if it evaluates correctly. Other than that I’d try to google it.
Good suggestion. Tried google, ChatGPT, but didnt find anything that would explain why it doesnt work. Will look at your approach. Thanks!
I had the same problem as Tom. Flow worked fine until I added this trigger. Has anyone figured this out? I seem to have this problem no mater what I put in for a condition with a recurrence trigger.
Sorry, same issue as Keith.
I tried the compose action and both input and output were false. Flow will only run if I remove the condition from the Recurrence trigger.
Hello Tamara,
that’s correct, if the conditions return ‘false’ the flow won’t even start. It’ll start only if the condition is evaluated as ‘true’.
Hi Tom, thank you for the wonderful logic here.
But i have a quick question- can you please tell me what should be the fields set to on the trigger now? should I make the ‘Interval’ as ‘1’ and ‘Frequency’ to ‘Month’?
Thank you in advance! and keep inspiring.
Hello Sindhusha,
the trigger is a recurrence every day. Every day it’ll check if the condition is satisfied, and if it is (once a month), it’ll let the flow start.
Hi Tom, i think some of the “equals” function are wrong.
For example: equals(dayOfWeek(utcNow(),1)
You missed a ‘)’ to close the dayOfWeek function. This happens on anothers functions too, take a look.
Thank you for the article, it helped me a lot!
Hello Damian,
thank you for noticing that, I hope I fixed all the missing brackets.
Hi all,
I need one help regarding trigger.How to trigger sixth working day of everymonth .whether I have to build flow or logic equation?
Hello sharmi,
I don’t know, the best I can do is the 5th working day: https://tomriha.com/trigger-power-automate-flow-on-a-specific-working-day-up-to-5th/
Hello Tom,
What if I want the workflow to run every first of the month, and the timezone that I need is GMT + 8, will the trigger condition below work if I were to set the workflow to run every day instead of every month?
equals(int(utcNow(‘dd’)),1)
Thanks!
Hello Germain,
you don’t need a trigger condition for that, just configure the recurrence trigger to run 1x per month with start time on the 1st of the previous month in your time zone.
Hello Tom,
I read your article it is realy helpful! I think it can be simplified if you set set trigger frequency to 1 week and hook on only Mon / Tue / Wed / Thu / Fri – then only the first part of the condition ist needed – correct?
I thought about it – the full trigger condition is still needed, but you can prevent not required runs if you hook off Sat + Sun.
This is great! The parentheses aren’t quite right. They should be done as below.
@or( and(equals(int(utcNow(‘dd’)),1),not(equals(dayOfWeek(utcNow()),6)),not(equals(dayOfWeek(utcNow()),0))),
and(equals(int(utcNow(‘dd’)),2),equals(dayOfWeek(utcNow()),1)), and(equals(int(utcNow(‘dd’)),3),equals(dayOfWeek(utcNow()),1)))
@Nick: thank you for this message – now my trigger condition works!
This works for me after comparing the triggers from Tom and Nick. Hope this helps to others as well:
@or(
and(equals(int(utcNow(‘dd’)),1),not(equals(dayOfWeek(utcNow()),6)),not(equals(dayOfWeek(utcNow()),0))),
and(equals(int(utcNow(‘dd’)),2),equals(dayOfWeek(utcNow()),1)),
and(equals(int(utcNow(‘dd’)),3),equals(dayOfWeek(utcNow()),1))
)