I am tracking benefit hours for each week, pay period (2 weeks) and quarter. My problem is that the quarter is not standard. The benefits quarter alternates a 14 week period with a 12 week period. I can only assume the use of alternating weeks is to keep the quarter ending on a pay period date, probably left over from manual calculations.
I am currently using a table lookup to get the quarter ending date but I would like to just create a field rule which calculates the date.
This year the problem is further complicated by a full pay period is left in the year after the quarter ends. In this case, an extra pay period (2 weeks) will be added to the quarter to adjust. This means that the 4th quarter will actually be another 14 week period. There will be three consecutive quarters of 14 weeks then quarters will revert to the 14-12 alternating time periods.
Quarters for 2008
Qtr 1 12/17/2007 to 03/23/2008 14 weeks (98 days)
Qtr 2 03/24/2008 to 06/15/2008 12 weeks (84 days)
Qtr 3 06/16/2008 to 09/21/2008 14 weeks (98 days)
Qtr 4 09/22/2008 to 12/14/2008 12 weeks (84 days) adjusted to end 12/28/2008 14 weeks (98 days)
Quarters for 2009
Qtr 1 12/29/2008 to 04/05/2009 14 weeks
Qtr 2 04/06/2009 to 06/28/2009 12 weeks
Qtr 3 06/29/2009 to 10/04/2009 14 weeks
Qtr 4 10/05/2009 to 12/27/2009 12 weeks
I need to be able to calculate the Quarter ending date, given any date. I currently calculate the Week_Ending date to search by key.
In other places, I calculate the Pay_Period ending date, again to do a search by key.
In the following formulae I use 1/7/1990 as a known Pay_Period ending date.
DIM my_date AS D
my_date = {11/17/2008}
'Calculate Sunday date
?{1/7/1990}+(ROUND_UP((my_date-{1/7/1990})/7,0)*7)
= {11/23/2008}
'or
?jtodate(7-(dow_iso(my_date))+ jdate(my_date))
= {11/23/2008}
'Calculate Pay Period Ending date
?{1/7/1990}+(ROUND_UP((my_date-{1/7/1990})/14,0)*14)
= {11/30/2008}
Does anyone have any ideas that will get me pointed in the right direction?
Thanks in advance,
Jerry Gray
I am currently using a table lookup to get the quarter ending date but I would like to just create a field rule which calculates the date.
This year the problem is further complicated by a full pay period is left in the year after the quarter ends. In this case, an extra pay period (2 weeks) will be added to the quarter to adjust. This means that the 4th quarter will actually be another 14 week period. There will be three consecutive quarters of 14 weeks then quarters will revert to the 14-12 alternating time periods.
Quarters for 2008
Qtr 1 12/17/2007 to 03/23/2008 14 weeks (98 days)
Qtr 2 03/24/2008 to 06/15/2008 12 weeks (84 days)
Qtr 3 06/16/2008 to 09/21/2008 14 weeks (98 days)
Qtr 4 09/22/2008 to 12/14/2008 12 weeks (84 days) adjusted to end 12/28/2008 14 weeks (98 days)
Quarters for 2009
Qtr 1 12/29/2008 to 04/05/2009 14 weeks
Qtr 2 04/06/2009 to 06/28/2009 12 weeks
Qtr 3 06/29/2009 to 10/04/2009 14 weeks
Qtr 4 10/05/2009 to 12/27/2009 12 weeks
I need to be able to calculate the Quarter ending date, given any date. I currently calculate the Week_Ending date to search by key.
In other places, I calculate the Pay_Period ending date, again to do a search by key.
In the following formulae I use 1/7/1990 as a known Pay_Period ending date.
DIM my_date AS D
my_date = {11/17/2008}
'Calculate Sunday date
?{1/7/1990}+(ROUND_UP((my_date-{1/7/1990})/7,0)*7)
= {11/23/2008}
'or
?jtodate(7-(dow_iso(my_date))+ jdate(my_date))
= {11/23/2008}
'Calculate Pay Period Ending date
?{1/7/1990}+(ROUND_UP((my_date-{1/7/1990})/14,0)*14)
= {11/30/2008}
Does anyone have any ideas that will get me pointed in the right direction?
Thanks in advance,
Jerry Gray
Comment