cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JonathanK
Level: Power Up

Run Flow on the last Sunday each month

Hi, I have a flow which I want to schedule to run on the last Sunday of each month. What is the best method to use to achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
SamPo
Level 10

Re: Run Flow on the last Sunday each month

@JonathanK Hi,

 

The only thing I can think of is to run the flow each week on Sunday and then use a number of conditions to check if it is the last Sunday of that month. Then put any actions you wish to perfom under this condition.

 

For example you could do the following

2019-04-15_0927.png

 

Formula for 'Current Day of Month' 

int(dayOfMonth(utcNow()))

Formula for ' Current Month'

int(substring(utcNow(),5,2))

Then use a condition to see if the current month has 30 days. If yes, then use a second condition to see if the current date is the 24th or later in the month (the last sunday of a month with 30 days must be on the 24th or later)

 

2019-04-15_0932.png

 

**Correction** the condition 'not equals to: 02' should be 'not equals to: 2' as the value is converted to int there is no leading 0

 

You can then repeat this condition for months that have 31 days and for feburary for 28 days. I recommend putting each of these 3 master conditions in a linear fashion rather than inside each other to make for a cleaner flow.

 

For months with 31 days, the last sunday should be at least the 25th of the month and for feburary it should be at least the 22nd of the month.

 

Hope this helps,

Sam

View solution in original post

2 REPLIES 2
SamPo
Level 10

Re: Run Flow on the last Sunday each month

@JonathanK Hi,

 

The only thing I can think of is to run the flow each week on Sunday and then use a number of conditions to check if it is the last Sunday of that month. Then put any actions you wish to perfom under this condition.

 

For example you could do the following

2019-04-15_0927.png

 

Formula for 'Current Day of Month' 

int(dayOfMonth(utcNow()))

Formula for ' Current Month'

int(substring(utcNow(),5,2))

Then use a condition to see if the current month has 30 days. If yes, then use a second condition to see if the current date is the 24th or later in the month (the last sunday of a month with 30 days must be on the 24th or later)

 

2019-04-15_0932.png

 

**Correction** the condition 'not equals to: 02' should be 'not equals to: 2' as the value is converted to int there is no leading 0

 

You can then repeat this condition for months that have 31 days and for feburary for 28 days. I recommend putting each of these 3 master conditions in a linear fashion rather than inside each other to make for a cleaner flow.

 

For months with 31 days, the last sunday should be at least the 25th of the month and for feburary it should be at least the 22nd of the month.

 

Hope this helps,

Sam

View solution in original post

JonathanK
Level: Power Up

Re: Run Flow on the last Sunday each month

Thank you @SamPo this certainly has put me on the right track and from my testing so far it works. Appreciate the detailed post, well done.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,356)