Hello,
In a report I have this structure:-
Week: [ ]
and the control source to display in the brackets I have:-
=Format$([MyDate],"ww",0,0)
which gives me the week number BUT this is starting at the beginning of the Calendar Year.
Is there any way to force this to have week 1 starting at the beginning of the Fiscal Year (1st April)
There is nothing in Regional Settings to do this. Maybe it might require a Function (UDF) to do it?
Any ideas?
Thanks
Report Week Number
-
- 4StarLounger
- Posts: 495
- Joined: 13 Sep 2013, 07:56
Report Week Number
Regards, Ben
"Science is the belief in the ignorance of the experts."
- Richard Feynman
"Science is the belief in the ignorance of the experts."
- Richard Feynman
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Report Week Number
Try the formula below...
This is untested by me, and for more info and explanation on the formula see this thread by Curious
In the control source of the Week control place this formula:
Note: It might be calculating from the fiscal week 1 Jul? You may need to edit something in the formula to offset it?
=IIf(IsDate([MyDate]),DateDiff("ww",DateSerial(Year([MyDate])-IIf([MyDate]<DateSerial(Year([MyDate]),7,1),1,0),7,1),[MyDate],4)+1,"")
This is untested by me, and for more info and explanation on the formula see this thread by Curious
In the control source of the Week control place this formula:
Note: It might be calculating from the fiscal week 1 Jul? You may need to edit something in the formula to offset it?
=IIf(IsDate([MyDate]),DateDiff("ww",DateSerial(Year([MyDate])-IIf([MyDate]<DateSerial(Year([MyDate]),7,1),1,0),7,1),[MyDate],4)+1,"")
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Report Week Number
Indeed, that formula uses July as first month (that's the significance of the 7s in the formula. For April:
=IIf(IsDate([MyDate]),DateDiff("ww",DateSerial(Year([MyDate])-IIf([MyDate]<DateSerial(Year([MyDate]),4,1),1,0),4,1),[MyDate],4)+1,Null)
=IIf(IsDate([MyDate]),DateDiff("ww",DateSerial(Year([MyDate])-IIf([MyDate]<DateSerial(Year([MyDate]),4,1),1,0),4,1),[MyDate],4)+1,Null)
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Report Week Number
HansV wrote:Indeed, that formula uses July as first month (that's the significance of the 7s in the formula. For April:
=IIf(IsDate([MyDate]),DateDiff("ww",DateSerial(Year([MyDate])-IIf([MyDate]<DateSerial(Year([MyDate]),4,1),1,0),4,1),[MyDate],4)+1,Null)
TX...I didn't study up the formula arguments.
I thought the 7's were referring to week day (as in 7 days in a week)
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 4StarLounger
- Posts: 495
- Joined: 13 Sep 2013, 07:56
Re: Report Week Number
Thank you both for that.
Regards
Regards
Regards, Ben
"Science is the belief in the ignorance of the experts."
- Richard Feynman
"Science is the belief in the ignorance of the experts."
- Richard Feynman