Change the definition of a 'Week'?

2019-08-12 07:03发布

I'm generating an overtime report, and while Crystal Reports can 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?

2条回答
霸刀☆藐视天下
2楼-- · 2019-08-12 07:24

You could group by {table.date} - 1.

查看更多
疯言疯语
3楼-- · 2019-08-12 07:30

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),"##")
查看更多
登录 后发表回答