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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Week for Grouping

Status
Not open for further replies.

kpeeler

Technical User
Jan 28, 2003
13
US
We use an odd work week and I need to create reports based on the Thursday - Wed schedule. I am using 8.5 and am trying to modify the following formula to break on Thursday rather than Friday as it does currently (this formula was from the Business Objects support site). My dyslexic brain keeps modifying it such that I get a Thursday and Friday break. Can anyone please help my tired brain, thanks in advance.

if dayofweek({Table.Field}) = [1,2,3,4,5] then
(numbervar x := (-(dayofweek({Table.Field}) + 1));
(dateadd("d", x, {Table.Field})))
else
if dayofweek({Table.Field})=6 then
({Table.Field})
else
if dayofweek({Table.Field})=7 then
(dateadd("d", -1 ,{Table.Field}))
 
Brian - Thanks for the response. That link is where I got the formula originally - I need help to modify it to result in a Thursday rather than Friday start date.

Thanks - Kevin
 
Try this one. It moves Sunday through Wednesday to the end of the last week. For example last week would have been July 8 through July 15:

if dayofweek({@date}) in 1 to 4 then
{@date}-dayofweek({@date})-2 else
{@date}-dayofweek({@date})+5

Mike
 
Mike - Simplicity is a virtue. Worked like a charm, also helped me understand better how the the DayOfWeek is being manipulated. If I could give you a raise I would - Thanks KP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top