gberkeley
asked on
query that divides month into "business weeks"
I need to break a report for date range of annual 09/01/YY - 08/31/YY+1) into weeks and months. Months is straightforward - Jan - Feb - Mar - April, etc. The weeks are what I can't figure out - what I need is a function like so:
for a given annual period of time, divide results into regular calendar quarters, then calendar months (Q1 = Sept-Oct-Nov; Q2 = Dec-Jan-Feb; etc). Then break the calendar months into business weeks such that a business week is usually, but not always, Monday through Friday. When the first week in a month doesn't start on a Monday, start that week on the first business day (Tues, wed, thurs, or Friday as applicable) and the week will have fewer than five days so that it ends on the first Friday. WHen the last week in a month doesn't end on Friday, end that week on the month's last business day and the week wil lhave fewer than five days.
End Result:
09/01/2010 - 08/31/2011 - annual period
09/01/2010 - 11/30/2010 = Q1
12/01/2010 - 02/27/2011 = Q2
03/01/2011 - 05/31/2011 = Q3
06/01/2011 - 08/31/2011 = Q4
09/01/2010 - 09/03/2010 = W1 (has only Wed - Friday)
09/06/2019 - 09/10/2010 = W2
09/13/2010 - 09/17/2010 = W3
09/17/2010 - 09/24/2010 = W4
09/27/2010 - 09/27/2010 = W5 (has only Monday - Thursday)
Week 1 - Week 5 belong to September 2010.
Assistance most welcome.
for a given annual period of time, divide results into regular calendar quarters, then calendar months (Q1 = Sept-Oct-Nov; Q2 = Dec-Jan-Feb; etc). Then break the calendar months into business weeks such that a business week is usually, but not always, Monday through Friday. When the first week in a month doesn't start on a Monday, start that week on the first business day (Tues, wed, thurs, or Friday as applicable) and the week will have fewer than five days so that it ends on the first Friday. WHen the last week in a month doesn't end on Friday, end that week on the month's last business day and the week wil lhave fewer than five days.
End Result:
09/01/2010 - 08/31/2011 - annual period
09/01/2010 - 11/30/2010 = Q1
12/01/2010 - 02/27/2011 = Q2
03/01/2011 - 05/31/2011 = Q3
06/01/2011 - 08/31/2011 = Q4
09/01/2010 - 09/03/2010 = W1 (has only Wed - Friday)
09/06/2019 - 09/10/2010 = W2
09/13/2010 - 09/17/2010 = W3
09/17/2010 - 09/24/2010 = W4
09/27/2010 - 09/27/2010 = W5 (has only Monday - Thursday)
Week 1 - Week 5 belong to September 2010.
Assistance most welcome.
ASKER
Hi Mathewspatrick:
- Correct. 09/27/2010 - 09/30/2010 = W5 (has only Monday - Thursday)
- Friday 1 Oct be the start of Week 6 (continue the week numbering from the prior month).
- For Jan 2011 the first business week of the month would be 1/3/11 through 1/7/11.
The weeks are divided up the way requested to accommodate performance measurements. Not the way I'd like to be doing it, believe me. I agree with you there. Craziness.
- Correct. 09/27/2010 - 09/30/2010 = W5 (has only Monday - Thursday)
- Friday 1 Oct be the start of Week 6 (continue the week numbering from the prior month).
- For Jan 2011 the first business week of the month would be 1/3/11 through 1/7/11.
The weeks are divided up the way requested to accommodate performance measurements. Not the way I'd like to be doing it, believe me. I agree with you there. Craziness.
>>The weeks are divided up the way requested to accommodate performance measurements.
I'd be curious to see how those performance measurements accommodate the fact that a "week" can have anywhere from 1-5 days.
>>Craziness.
I feel your pain :)
I'd be curious to see how those performance measurements accommodate the fact that a "week" can have anywhere from 1-5 days.
>>Craziness.
I feel your pain :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so very much!!! There' s no doubt in my mind why you're a "Hall of Famer"!!!! The proposed solution is exactly what I needed and I could never have solved this on my own. I very much appreciate not just the answer itself, but the fast reply, the excellent questions to make sure you understood what I needed, and the clarity in the responses. You've made my whole week so much better!!!! A++++
Glad to help :)
09/27/2010 - 09/30/2010 = W5 (has only Monday - Thursday)
Anyway, would Friday 1 Oct be the start of Week 1 (i.e., start the week numbering over with a change in month), or of Week 6 (i.e., continue the week numbering from the prior month)?
Also, what would we do about a month such as Jan 2011? The 1st of the month is a Saturday; would we deem that the start of a week, and then that Monday, the 3rd, the start of another week?
I'm really not seeing the usefulness of breaking months up into individual weeks...