cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shap1
Helper II
Helper II

Adding 2 fields together (one decimal and one date field) to another date field

Looking for some help adding 2 fields together into a third date field. Below are the 2 fields needed to calculate/update the third field.

 

'Actual Start Date' (date field):

Shap1_0-1656450685649.png

PLUS

 

'Assignment Length' (decimal field which is entered in as months. So this would read as 5 months)

Shap1_1-1656450728950.png

EQUALS

 

'Estimated End Date' (date field)

Shap1_2-1656450813962.png

 

Not sure if this would end up just being a calculated field but wanted to know if it can be done via a power automate flow.

 

Thanks in advance. 

 

@abm 

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Shap1 

 

@ryleybauer  above its mentioned that  'Assignment Length' (decimal field which is entered in as months. So this would read as 5 months)

 

There is no addMonths() expression available in PowerAutomate but there is another action called Add To Time there. Please see below.

 

image.png

 

Above expression I used are

 

formatDateTime(outputs('Compose_2'),'MM/dd/yyyy')
 
int(outputs('Compose'))
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

7 REPLIES 7
ryleybauer
Resolver II
Resolver II

You could do it either way. 

If you did it as a flow, you could use the "When an item is created or modified" trigger, a "Compose" step using the "addDays()" expression (it requires integer integers though, but I think an int() conversion will round). Finally, add an "update item" step with all of the required fields and the "outputs" from the compose step into the date field. 

ryleybauer_0-1656451631389.png

 

It'd be easier as an SPO calculated column in my opinion. 

Calculated Field Formulas | Microsoft Docs

For "Estimated End Date", Try: 

=['Actual Start Date'] + ROUNDUP(PRODUCT(['Assignment Length'],30),0)
(I don't remember if you need single quotes around column names with spaces, try without if it doesn't work)

 

Please mark as solution if I've helped with this! 

abm
Super User
Super User

Hi @Shap1 

 

@ryleybauer  above its mentioned that  'Assignment Length' (decimal field which is entered in as months. So this would read as 5 months)

 

There is no addMonths() expression available in PowerAutomate but there is another action called Add To Time there. Please see below.

 

image.png

 

Above expression I used are

 

formatDateTime(outputs('Compose_2'),'MM/dd/yyyy')
 
int(outputs('Compose'))
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

You're right that there is no add months function. I think the Add to time action is a good suggestion for proper time units of "months"! 

I just used addDays(DATE, int( 'Assignment Length' * 30)), which assumes a 30 day month.

While this is the Power Automate forum, it's probably easier to do a calculated column as you can simply add days to a date with the "+" operator: 

=['Actual Start Date'] + ROUNDUP(PRODUCT(['Assignment Length'],30),0)

Hi @ryleybauer 

 

The issue here is it doesn't give the exact date 30,31 or leap years.

 

Thanks for your reply.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Shap1
Helper II
Helper II

@abm @ryleybauer thank you both for your input.

 

I went the flow route and it worked! Really appreciate the help.

 

Shap1_0-1656512179850.png

 

Hello @abm @ryleybauer- I am getting a lot of errors now and not exactly sure. Perhaps you can help:

 

 

error1.png

 

 

error2.png

 

 

error3.png

Hi @Shap1 , can you please provide a screenshot of the output from your compose_2 step? The error message says the date is null.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,161)