cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RDJHUD
Regular Visitor

Create a date field that auto calculates based on another date field

I am setting up a CDS entity for an app I'm creating.  I have several date fields that I'm putting in statically, but I have some date fields that will need to be calculated off of another field.  So, I create Field A in my entity and it's a date picker.  I then need to create another field that automatically calculates 120 days after the date selected in Field A.  Is there a way to do this?  I have seen references to some ways that have to do with coding, but honestly I'm new to Power Apps and CDS, so I'm not sure where to begin actually inserting that coding as I don't see any "custom" fields that accept the coding.  I'm probably missing something when it comes to that, so forgive my ignorance.  I have no problem coding, I studied coding in college and have done minor coding projects, but I am NOT a developer...which is why I like the "low code" environment here.

 

Thanks, 
Randy

2 ACCEPTED SOLUTIONS

Accepted Solutions
ChrisPiasecki
Super User
Super User

Hi @RDJHUD,

A calculated field should do the trick. In the Action, the expression would use the date function:

ADDDAYS(120, 'Field A')

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

EricRegnier
Super User
Super User

Hi @RDJHUD

 

EDIT: I didn't see @ChrisPiasecki post. It is the same as mine, so please discard this.

 

You can also do this out-of-the-box with calculated fields which I recommend to simplify your app's logic and ability to use it for future needs if required. Here's an example (replace createdon with field A):

 

2020-11-08_20-53-44.png

Hope this helps!

View solution in original post

3 REPLIES 3
ChrisPiasecki
Super User
Super User

Hi @RDJHUD,

A calculated field should do the trick. In the Action, the expression would use the date function:

ADDDAYS(120, 'Field A')

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

EricRegnier
Super User
Super User

Hi @RDJHUD

 

EDIT: I didn't see @ChrisPiasecki post. It is the same as mine, so please discard this.

 

You can also do this out-of-the-box with calculated fields which I recommend to simplify your app's logic and ability to use it for future needs if required. Here's an example (replace createdon with field A):

 

2020-11-08_20-53-44.png

Hope this helps!

View solution in original post

RDJHUD
Regular Visitor

Thanks to both of you.  I think I was going about this all wrong.  I was trying to do this all in the actual CDS entity, not in the canvas app.  But, now that I think about it and your input it makes sense.  Your input will help me once I move on to making the app. Thanks!  Randy

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,939)