Forum Discussion
28 Replies
Sort By
- LisaSell1Qrew TraineeI have a similar form, so I plugged in Mark's variables but made a slight adjustment to 'Week':
var number WeeksSinceFirstWeek =
(ToDays(LastDayOfWeek([date])-[Ending Saturday of First Week of Year]))/7;
If($WeeksSinceFirstWeek =53,1,
$WeeksSinceFirstWeek+1)
It works when selecting past or future dates (process date), hope this helps - LisaSell1Qrew TraineeActually, that didn't work so well - I eventually added another field called Week_numbers:
If([Week number]>52,1,[Week number])
to use in my report & on my form - MichelleChapmanQrew Assistant CaptainSo do you have a field for week that has this formula that tends to pull Week 53-
var number WeeksSinceFirstWeek =
(ToDays(LastDayOfWeek([date])-[Ending Saturday of First Week of Year]))/7;
$WeeksSinceFirstWeek+1)
Then a [Week number] field with this formula to move week 53 to Week 1?
If([Week number]>52,1,[Week number]
Then just hide the Week field and display Week Number instead? - MichelleChapmanQrew Assistant CaptainThat worked :)
- MichelleChapmanQrew Assistant CaptainThis has been working really well, thought all the kinks were worked out but now it's quirky again.
So if the Process Date (which is in the future in this case) is 12/30/19 the ending Saturday should switch to 1/4/2020. The ending Saturday is calculated off of the Process Date so I don't no why it is static.
As a recap....
I have a [Week Number] field that has this formula:
var number WeeksSinceFirstWeek =
(ToDays(LastDayOfWeek([Process Date])-[Ending Saturday of First Week of Year]))/7;
$WeeksSinceFirstWeek+1
I have a [Week] field that has this formula...
If([Week Number]>52,1,[Week Number])
[Process Date] is a regular Date Field that is usually Today() but I had to back enter a lot of data so I do not put that in as a formula.
My [Year] field:
Year([Ending Saturday of First Week of Year])
And [Ending Saturday of First Week of Year]:
LastDayOfWeek(FirstDayOfYear([Process Date]))
Is it my [Year] field? Does it need something to designate that it is referring to the [Ending Saturday First Week of the Year] for the process date...It has trouble understanding that I want the year to be the year for the ending Saturday not the process date. In the image below 12/30/18 is supposed to be the 1st day of the year for 2019 reporting so the week is good but the year is wrong. - MichelleChapmanQrew Assistant CaptainMaybe I should create a [Report Date] formula-date field. LastDayofWeek([Process Date)]
Then change the [Ending Saturday of First Week of Year] formula to LastDayofWeek(FirstDayofYear([Report Date]))
Think that might work or add another field and still get the same result? - MichelleChapmanQrew Assistant CaptainYay, that worked! So that's my advice to anyone who looks at this thread :)