cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mandy4514
Level: Powered On

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
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
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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 98 members 3,753 guests
Please welcome our newest community members: