“I’d like to schedule a flow in Power Automate that will run only once a month on the first Tuesday, is that possible?”
Power Automate offers some options to schedule a flow directly in the ‘Recurrence’ trigger. You can run a flow on a regular basis: daily, weekly, monthly, on specific days…, generally after a fixed time period. But what if you need to run the flow only once a month on a specific day in the week? Not a specific date, e.g. second day of the month, but a specific day, e.g. first Tuesday of the month?
Monthly recurrence allows you to select a date, not a day. Weekly recurrence allows you to select a day within a week, but ignores month. You could schedule recurrence on Tuesday every 4 weeks, but what about months with 5 Tuesdays? How do you tell the flow to run only the first Tuesday in each month?
Start from ‘Week’ frequency
You must split the scheduling into two parts. First, you limit the flow to run only on Tuesday’s, skip all the other days. Second, you further limit it only to the first Tuesday, skipping all the other Tuesdays.
The first part is simple, just switch to the ‘Week’ frequency as when scheduling flow to run only on selected days, and select ‘Tuesday’. This setting will schedule the flow to run on Tuesday every week.
Add trigger condition
The second part is to limit the flow only to the first Tuesday of the month. Being a first Tuesday in a month means that the date must be between 1st and 7th in given month. One week has 7 days, if the date would be higher than 7 it would mean it’s not within the first week. The flow should run only if given Tuesday’s date is less than 7.
You can add a trigger condition into the ‘Recurrence’ trigger to perform this calculation. Since the flow will run only on Tuesday, it’ll check the date only on Tuesday’s and take only the day part from the date into the comparison.
run only if the date part from today's date is less than 8 (= 1 to 7):
@less(int(utcNow('dd')),8)
Notes:
utcNow('dd') will take only the day part from today's date
int(...) will convert the day from today's date into an integer
less(...) will compare if the day part from today's date is less than 8
If your goal is to run in on second Tuesday, you can use the same approach. Find the possible dates for second Tuesday and check if the “current” Tuesday is in between.
@and(less(int(utcNow('dd')),15),greater(int(utcNow('dd')),7))
The third one would then be as below:
@and(less(int(utcNow('dd')),22),greater(int(utcNow('dd')),14))
Summary
This post was about running a flow only on a first Tuesday in a month, but you can use the same approach for any other day. Using the combination of the trigger settings and trigger condition gives you much more possibilities than the trigger itself. It’s a similar approach as when avoiding multiple approval flow runs: if you can’t achieve the required functionality directly, split it into smaller pieces and combine them.
What would the code need to read if I needed to send on the 2nd Tuesday of the month?
Hello Chip,
the trigger condition would be similar, only searching for a date greater than 7 and less than 15.
@and(less(int(utcNow('dd')),15),greater(int(utcNow('dd')),7))
update: closing bracket was added at the end
what would be condition to run every alternate month only on 3rd Wednesday.
Hello Maddy,
it’s the same principle, you just need to move the day numbers one week further: day is less than 22nd and greater than 14th.
@and(less(int(utcNow('dd')),22),greater(int(utcNow('dd')),14))
update: closing bracket was added at the end
Hi Tom, I was searching for this solution for hours and hours. Thanks for helping. One question/concern. I was trying to set up a flow to trigger an email on the third Monday of each month. So I figured it was the same logic as you have above but instead of it being Tuesday (as the example requested) I used the Monday “On these days – Monday”. When I pasted the formula you have above I get an error. “The power flow’s logic app flow template was invalid. Unable to parse template language expression ‘and(less(int(utcNow(‘dd’)),22),greater(int(utcNow(‘dd’)),14)’: expected token ‘RightParenthesis’ and actual ‘EndOfData’.”
Do you know how to fix that?
Hello Ron,
do you have the @ character at the beginning of the condition: @and(less(int(utcNow(‘dd’)),22),greater(int(utcNow(‘dd’)),14)?
Tom, Ron. I struggled with this but I think there is a missing parenthesis at the end of the code. So I think it should be @and(less(int(utcNow(‘dd’)),22),greater(int(utcNow(‘dd’)),14)). Can someone check that it works for them because it seems to work for me. Regards Rob
Hello Rob,
you’re right, I totally overlooked the missing closing bracket. Thank you for pointing that out.
I just wanted to compliment you on your site. It has been very useful to me. I also needed a trigger when it is the second Tuesday of a month. Thank you so much for these Power Automate tips.
Hi Tom,
I’m looking for a trigger to run every 2nd and last Wednesday of a month. I currently have these 2 expressions but it does not account for months where there are 5 weeks of a month. I believe the second expression covers the 2nd Wednesday but my first expression does not. Any tips?
@greater(int(utcNow(‘dd’)),25)
@and(less(int(utcNow(‘dd’)),15),greater(int(utcNow(‘dd’)),7)
Hello Dylan,
take a look on the new post how to check for the last day in a month: https://tomriha.com/schedule-power-automate-flow-to-run-only-last-friday-of-the-month/. In your case you’ll have to turn it into a single OR expression that’ll check both, the 2nd and last Wednesday.
@or(and(less(int(utcNow('dd')),15),greater(int(utcNow('dd')),7)),)
Sorry Tom, just one more question. I presume that I can test the flow for errors but if it doesnt meet the trigger conditions then the email will not send? For example, running one now for the second Tuesday of the month will not work until Friday 8th April? Is there any way of testing that the email will send without changing the trigger condition? Thanks in advance Rob
You can’t, the trigger condition is the ultimate blocker, unless it’s true you can’t test nor run the flow. You’ll have to either remove it for the testing or adjust it to fit today’s date.
Great thanks Tom. I thought that would be the case but wanted to check………..now I just have to wait for each week to see if it works. Thanks for your help
I had the same situation and my solution for it was that I simply changed trigger condition to 3rd Friday of the month. I know that you wrote that you don’t want to change condition but when 3rd Friday works then 2nd Thuesday will work too 🙂
Very nice solution. Thank you!
I tried the third Tuesday and keep getting an error. This is what I put in: @and(less(int(utcNow(‘dd’)),22),greater(int(utcNow(‘dd’)),14)). What am I doing wrong?
Hello Andrew,
the expression looks fine, I’d just try to replace the single quote characters as Power Automate needs a different character for the quotes than wordpress uses.
Tom,
Thank you for explanation however I am still not getting it. Would you please post it again so I can just copy and paste.
Hello Andrew,
I just noticed I had the wrong quote characters in the example, if you copy/paste it now from the article it should work.
I am wanting to run the trigger the third thursday of the month and not sure how to do this. Will you please advise?
Hello Jenn,
it’s one of the examples in the article, you can just copy/paste it as the trigger condition.
Hi Tom,
On these days I selected: Tuesday
In Trigger box I mentioned: @less(int(utcNow(‘dd’)),8)
After putting the above condition , I am getting the below error message:
Cannot read properties of undefined (reading ‘properties’)
Hello Nitin,
that seems to me like some random Power Automate designer error, as if it didn’t load some component properly.
same as Nitin, but different error – The power flow’s logic app flow template was invalid. The template language expression ‘less(int(utcNow(‘dd’)),8)’ is not valid: the string character ‘‘’ at position ’16’ is not expected.
I see the issue… the quotation marks are invalid…. needs to be ‘ and ‘ not
Hi, How to I schedule to run on the first weekday of every month. Thanks!
Hello Tammy,
this should work: https://tomriha.com/trigger-power-automate-flow-on-the-first-working-day-in-a-month/
Can you help with triggering on the fourth business day of the month?
Hello Ellen,
the solution is explained in another article: https://tomriha.com/trigger-power-automate-flow-on-a-specific-working-day-up-to-5th/
Hi Tom, how would the “@less(int(utcNow(‘dd’)),8)” trigger code be amended if I want to add one day to the utcNow integer result? Love this resource you have created.
Hello Paul,
@less(add(int(utcNow(‘dd’)),1),8), but with the right quotes.
Hi Tom,
How would you create a trigger condition on recurrence for the following scenario:
Every 5th Tuesday of the current month, and if there is not a 5th Tuesday in the current month, trigger the recurrence to occur on the 1st Tuesday of the following month.
Note: 1st Tuesday of the current month is not triggered unless the previous month only had 4 Tuesdays.
I know this sounds super complicated and I’m stuck on how to get this setup
Hello Lori,
no idea, that really sounds super complicated. 🙂 It’d have to somehow involve addToTime(…) to check the previous month, somehow calculate how many Tuesdays it had and depending on the result use the 1st Tuesday or not, but such expression would be a lot of work to create.
Tom… mad props to your site and solution. Just like Ron in the comments above, hours of searching no one addressed this scenario. So again thank you for this post!
Hi,
I’m looking what would be every second sunday of the month. Any tips?
Hello Matt,
I’m sure that something similar was already discussed in the comments.
Would this also work if I wanted to send an email out quarterly (once per every 3 months) and wanted to have it sent on the first Monday of the week? If so, what would the expression for the trigger condition look like?
Hello Jefferson,
it would work, but you’d have to add also the month to the condition in the same way. I might add it to my list of potential articles in the future.
hey Tom, could you help to build one that will run the flow quarterly and that too on the very first monday of each quarter?
Hello Shashank,
since a flow not running for 90 days would be deactivated you can use the same solution. Run it on the first day every month with a condition where you check whether the month – the expression utcNow(‘MM’) – is equal 01, 04, 07 or 10 and do the stuff.
Hi Tom, I need to set a flow up to run the 2nd Friday of each month.
Hello Shannon,
the article explains how to do a day in 2nd week, just change Tuesday for Friday in the trigger.
Hello Tom,
I am trying to create a flow that shows send an email only first Wednesday of the month but when I use the trigger condition
I get an error saying
Request to Azure Resource Manager failed with error: ‘{“error”:{“code”:”WorkflowTriggerHistoryNotFound”,”message”:”The workflow ’40d82289-7fe5-430f-a26a-d1e8fc3dd69c’ trigger ‘Recurrence’ history ‘null’ could not be found.”}}’.
Can you please advise what needs to happen
Thank you
Hello Krista,
I’ve never seen this error message, I’d try to delete the trigger and add it again.
Hi Tom
I am also facing the same issue. i have added the trigger again but same error.
Hi Tom,
Is it possible to schedule the x business day from the end of the month using the trigger condition?
Hello Mark,) remove the desired amount of days with addDays(startOfMonth(…),-X) and check if it’s a working day with dayOfWeek(..) and if it’s not Mon-Fri you repeat the same with X+1.
I guess it could be possible using some complex combination of expressions where you take startOfMonth(
im getting an error with the tracking id. (The power flow’s logic app flow template was invalid. The ‘clientTrackingId’ value is not valid. The value cannot be null or all whitespace characters.) have you come across this before?
Hello Edi,
the error message doesn’t feel familiar, either I didn’t see it or it was ages ago and I forgot about it.
i want to trigger flow, on the 8th working day of each month how these can be done