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 II
Super User II

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 II
Super User II

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Users online (14,662)