Showing results for 
Search instead for 
Did you mean: 
Post Patron
Post Patron

Add 1 month to date

I have End date, and Extended date. Right now, I want to calculate Final Date.


If I have End date, I need to add a month to the date. If End date is empty, then I have to add a month to Extended date to get the final date. How do I do the flow? 



Super User
Super User

Hi @NurNina,


In the set variable of the Final Date field you could use if and empty functions in a expression to achieve this.


Below is an example:

if(empty(variables('EndDate')), addDays(variables('ExtendedDate'),30), addDays(variables('EndDate'),30))



Hi @Expiscornovus ,


How about the months without 30 days?

Super User
Super User

Hi @NurNina,


If the end date is on the 5th you want the final date value to also be on the 5th the next month? Regardless if the month has less (working) days or even if it's a leap year?


If that's the case you should be able to use the addToTime function instead. Use this expression instead:


if(empty(variables('EndDate')), addToTime(variables('ExtendedDate'),1,'Month'), addToTime(variables('EndDate'),1,'Month'))



hi @Expiscornovus ,

thanks for the feedback. so addtoTime doesn't count the leap year is it? If I want to include leap year,there must be a calculation right? 

Super User
Super User

Hi @NurNina,


No that shouldn't be needed. The addToTime should also handle leap years. I have tested it with 12th of February 2020 and the Final Date is set as the 12th of March 2020.



Hi @Expiscornovus, I've tried it,and it works perfectly for creating new data. However, when I try to trigger existing  record using the addtoTime, it doesn't give the correct result: 




Final date:









Super User
Super User

Hi @NurNina,


It's not entirely clear what you are doing in your flow from the screenshots.


But I am assuming that you are looping through a set of end dates? If that's the case my guess would be that you also need to put that set variable 3 action within the first apply to each loop which contains the set variable action.


If the set variable 3 action is outside of the loop it will probably be only applied to your last date of record 69.


I hope that makes sense?

Helpful resources

2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,919)