Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Date Two Weeks


This topic is 7843 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I can calculate the current week using the following calculation, but I do not complete understand why it works so I cannot make it calcuate last week or the week before that

DateToText(Status( CurrentDate) - Middle("6012345", Mod(Status( CurrentDate) - Date(1,3,1904),7)+2,1)) & "..." &DateToText( Status( CurrentDate) - Middle("6012345", Mod(Status( CurrentDate) - Date(1,3,1904),7)+1,1) + 5)

The above calc will give me 4/13/2003...4/19/2003, but what I need is calc that if it is a Monday would be the past 2 weeks. The example below.

4/6/2003...4/12/2003

and

3/31/2003..4/5/2003

Any help would be great.

Link to comment
Share on other sites

Give this calc a try. This calc will only evaluate if it is Monday, otherwise the field will be empty. If you need to retain the values, you will need to use a script to set the values in the field. If you use as a calc, select "Do not store calculation results" under storage options.

Case(

DayofWeek(Status( CurrentDate)) = 2, DateToText(Status( CurrentDate) - 8)&"..."&DateToText(Status( CurrentDate) - 2)&"

Link to comment
Share on other sites

Hi Brian,

ThisWeek'sSunday = Status(currentdate) - MOD(DayofWeek(Status(currentdate)) +7-1; 7) will return the 1st day of current week (Sunday in your calc ?)

ThisWeek'sSaturday = Status(currentdate) + MOD(7-DayofWeek(Status(currentdate)); 7) will return the last day of current week (Saturday in your calc ?)

ThisWeek = DateToText(ThisWeek'sSunday) & "..." & DateToText(ThisWeek'sSaturday)

IMHO The past weeks should be

PastWeek = DateToText(ThisWeek'sSunday -7) & "..." & DateToText(ThisWeek'sSaturday-7)

Past2Week = DateToText(ThisWeek'sSunday -14) & "..." & DateToText(ThisWeek'sSaturday-14)

and your calc should be B)

Case(DayofWeek(Status( CurrentDate)) = 2, PastWeek & "

Link to comment
Share on other sites

isn't there a function "week of year"? or "week of fiscal year"

just do a calc on all your dated items and use currentweek -1, currentweek -2 and so on ...

Of couse, you will have to provide for last week of december ...

Link to comment
Share on other sites

Hi,

isn't there a function "week of year"? or "week of fiscal year"

This would turn the dates in numbers though....

If you want to display the dates as asked using these functions, you'll lead to circular problems as you will need to re-use the calc based on the date given.

If your calc should be based on the week number, then check this post

Reversing week dates into regular dates

Link to comment
Share on other sites

This topic is 7843 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.