cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Use calculated date to show another field in view or edit mode within 2 week window

I have a power app linked to a sharepoint list.  I have a calculated date field in the share point list. What I am trying to do is if today's date is within 2 weeks (1 week prior and 1 week after) of the calculated date I want the field to be in edit mode. If today is not within that 2 week window I want the field to be view only.

this is what I have come up with. The calculated date in this formula is '4 Mth Date'. This is not working.

If(DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue('4 Mth Date'))>0,DisplayMode.Edit,DisplayMode.View)

Any ideas?  I am trying to put this on the card's display mode.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Use calculated date to show another field in view or edit mode within 2 week window

@mandy4514 

If I understand you on this, you're looking for a datacard to be in edit or view mode based on the record date (in your calculated date) being within a 1 week (7 day) before or after today's date window.  

 

If so, then consider this formula:

If(Abs(DateDiff(DateValue('4 Mth Date'), Now(), Days)) > 7, View, Edit)

This will determine the number of days (DateDiff) between now and the calculated date.  It then takes the Abs value (positive value) of that DateDiff.  If it is greater than 7 (more than a week), then it will be in View mode, otherwise it will be in Edit mode.

 

I hope this is helpful for you and clear.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Use calculated date to show another field in view or edit mode within 2 week window

@mandy4514 

If I understand you on this, you're looking for a datacard to be in edit or view mode based on the record date (in your calculated date) being within a 1 week (7 day) before or after today's date window.  

 

If so, then consider this formula:

If(Abs(DateDiff(DateValue('4 Mth Date'), Now(), Days)) > 7, View, Edit)

This will determine the number of days (DateDiff) between now and the calculated date.  It then takes the Abs value (positive value) of that DateDiff.  If it is greater than 7 (more than a week), then it will be in View mode, otherwise it will be in Edit mode.

 

I hope this is helpful for you and clear.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

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

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,719)