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

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

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,511)