Change the definition of a 'Week'?
I'm generating an overtime report, and while Crystal Reports c开发者_开发百科an group an employee's shifts into weeks, it uses a standard Sunday-Saturday week; I need a Monday-Sunday week(ie, Sept 12-18th inclusive). Is there any way to change this setting, or am I stuck with writing a complex formula?
I don't know of a setting that will allow you to do this, but the group formula is not too bad. The following will give you the week number/index in the year using Mondays as the start of the week.
datepart("ww",{table.date},crMonday)
You will probably want to incorporate the year, too. You can ensure proper sorting by year and week with this
totext(datepart("yyyy",{Orders.Order Date}),"####") + " "
+ totext(datepart("ww",{Orders.Order Date},crMonday),"##")
You could group by {table.date} - 1
.
精彩评论