web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : WfGtrWl8ocJ6/BDXoMVerF
Power Automate - Building Flows
Suggested answer

last day of next month

Like (0) ShareShare
ReportReport
Posted on 7 Nov 2024 11:16:51 by 30
Hi All
 
I have a flow which runs on the last day of each month. At the moment I have to go into the flow on the first of each month and set it again for the last day. 
 
Each time the flow executes I want to store the last day of the month for next month within a variable and use the variable to trigger the flow. 
 
I'm thinking get the start of the month add two months and subtract a day. 
 
I've got the start of the month fine its just the adding two months and subtracting a day I can't get working. 
 
Any help much appreciated. 
 
Thanks
 
 
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    12,264 Super User 2025 Season 2 on 07 Nov 2024 at 13:37:52
    last day of next month
    If you start the schedule of the flow on a month that has 31 days, and set the interval to 1 month, the flow will run on the last day regardless of the number of days in the month. 
     
    I have been testing this method for several months now and it seems to work. I cannot find this documented anywhere, but Run flows on a schedule in Power Automate - Power Automate | Microsoft Learn does note: If you run a flow on the month frequency, the flow runs on the same date each month.
  • Chriddle Profile Picture
    8,141 Super User 2025 Season 2 on 07 Nov 2024 at 13:28:04
    last day of next month
    Not very elegant, but I can't come up with something beter:
     
    - Schedule the flow to run once a day
    - Check if utcNow('yyyy-MM-dd') equals the following expression (last day of the current month):
    addDays(
    	startOfMonth(
    		addDays(
    			startOfMonth(utcNow()),
    			32
    		)
    	),
    	-1,
    	'yyyy-MM-dd'
    )
    - If not, terminate the flow
     
    Note that your local date must match the UTC date at the time your flow runs.
    Otherwise, things get more complicated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 725 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 363 Moderator

#3
Power Apps 1919 Profile Picture

Power Apps 1919 341

Last 30 days Overall leaderboard
Loading started