Get Next Month and Previous Month in Power Automate/ Microsoft Flow.

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com

With each new release, Microsoft add new feature to Power Automate. And these new features does not cease to amaze every Power Apps consultant out there.

But sometime the simplest of requirement take us by surprise. And the same goes for the requirement I had to complete using Power Automate – “How to get Next month and Previous month in Power Automate?”

You might be wondering – Isn’t it too simple a requirement to achieve using Power Automate? Aren’t there built-in functions which can do this requirement? And I am sure by now functions like Month(), Year() are cooking inside your brain.

Sorry to disappoint you, these functions are not there in Power Automate. However we can achieve this using very simple technique. So let’s explore it.

For this demo I have used the “Manually trigger a flow” option. Below is the screenshot of the flow to get Next Month. Today’s date at the time of writing this blog is – 27th July 2020.

Power Automate Flow to get Next Month

As you can see in the above screenshot, I have used the “Add to Time” action. And using the action, I add one month to the current date and time.

In the next step, I use the “Convert time zone” action to convert the UTC time to my time zone which is India Standard time (IST).

Related Content

Observe the “Format string” value – MM. I have explicitly chosen a format which return the month value only. When I run the flow, I get the below output.

Power Automate to get Next Month

I leave it to you to parse the Month value in the body of output into a variable.

Similarly for Previous Month, we need to pass Interval as “-1” as shown in the below screenshot.

Power Automate Flow to get Previous Month

Hope this helps!

Debajit Dutta (Business Solutions MVP)