Change the definition of a 'Week'?

南笙酒味 提交于 2020-01-05 07:31:00

问题


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?


回答1:


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),"##")



回答2:


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



来源:https://stackoverflow.com/questions/7531322/change-the-definition-of-a-week

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!