Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Date Group by Week to start from the first parameter date 1

Status
Not open for further replies.

SABS

Programmer
Nov 21, 2003
14
CA
In Crystal 8.5 I need a report that receives a date parameter and displays the four weeks of data prior to the date grouped by week, the weeks ending on Sunday.

My problem is the grouping starts on the first date of the returned data, not the first date of the four week range. Therefore, if the range is Feb 2 to Mar 1/2004 and the lowest date returned is Feb 4 the groups are Feb 4 - Feb 10, Feb 11 - Feb 18, etc. instead of Feb 2 - 8, Feb 9 - 14, etc.

Do you know of a way to begin the date grouping on the first parameter date?
 
For your date group, use the following formula:

{table.date}-dayofweek({table.date},crMonday) + 1

Group on this and then choose "customize group name" ->"Use a formula as a group name" and enter:

totext({table.date}-dayofweek({table.date},crMonday)+1)+ " to " + totext({table.date}-dayofweek({table.date},crMonday) + 7)

While this will display the weekly groups with dates that always reflect Monday to Friday, regardless of whether records exist for Monday or Friday, it will not show weekly groups if there are no records at all for that week.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top