Week Number of a Month in CR 8.5?
Week Number of a Month in CR 8.5?
(OP)
Is there a Date function or or do I have to write a formula to determine the week number of a given month (see output example below)
Week Total Premium
Period Amount
Sept 2003 Week 1 $45.00 (ex. this input date would be between 09/01/2003 to 09/06/2003)
Sept 2003 Week 2 $25.00 (ex. this input date would be between 09/07/2003 to 09/13/2003)
Sept 2003 Week 3 $20.00
Sept 2003 Week 4 $30.00
Sept 2003 Week 5 $ 0.00
Oct 2003 Week 1 $10.00
Week Total Premium
Period Amount
Sept 2003 Week 1 $45.00 (ex. this input date would be between 09/01/2003 to 09/06/2003)
Sept 2003 Week 2 $25.00 (ex. this input date would be between 09/07/2003 to 09/13/2003)
Sept 2003 Week 3 $20.00
Sept 2003 Week 4 $30.00
Sept 2003 Week 5 $ 0.00
Oct 2003 Week 1 $10.00

Talk To Other Members
RE: Week Number of a Month in CR 8.5?
Insert a group on the date field. Make sure that you group it for each month. Also, Suppress the header and footer. This is needed to keep the next group in the proper order.
Create this formula:
WhileReadingRecords;
dateVar myDate := {Orders.Order Date}; //replace with your date field
numberVar DayNum := Day(myDate);
numberVar Week1Saturday := (7 - DayofWeek(Date(Year(myDate), Month(myDate), 1))) + 1;
stringVar WeekNum;
if DayNum IN [1 to Week1Saturday] then
WeekNum := "1"
else if DayNum IN [(Week1Saturday + 1) to (Week1Saturday + 7)] then
WeekNum := "2"
else if DayNum IN [(Week1Saturday + 8) to (Week1Saturday + 14)] then
WeekNum := "3"
else if DayNum IN [(Week1Saturday + 15) to (Week1Saturday + 21)] then
WeekNum := "4"
else if DayNum IN [(Week1Saturday + 22) to (Week1Saturday + 28)] then
WeekNum := "5"
else
WeekNum := "6";
MonthName (Month(myDate), True) + " " + ToText(Year(myDate),"0000") + " Week " + WeekNum
Group on this new formula.
Add your Summaries to Group Header 2.
Suppress the detail section.
~Brian
RE: Week Number of a Month in CR 8.5?
Datepart("ww",{table.date})+1
- Datepart("ww",{table.date} - Day({table.date})+1)
I'm not clear what your requirements are, but for the week of September 28, 2003 to October 4, 2003, if {table.date} was September 30, it would return "5", but if {table.date} was October 2, 2003, it would return "1".
-LB