Calculating monthly periods with non traditional dates...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My boss has required that I use non-traditional dates (starting the 21st of
one month and ending on the 20th of the next month) in calculating cycle
quantities. How do I write that in my query to have allow it to calculate
that way for multiple separate periods at the same time?

Thanks,

Joe
 
My boss has required that I use non-traditional dates (starting the 21st of
one month and ending on the 20th of the next month) in calculating cycle
quantities. How do I write that in my query to have allow it to calculate
that way for multiple separate periods at the same time?

Thanks,

Joe

One way is to use a "non equi join" to a date-range table. You could
have a Table FiscalDates with fields FYear, FMonth, Start and End,
with records like

2006 January 1/21/2006 2/20/2006
2006 February 2/21/2006 3/20/2006
<and so on>

You could use a Query joining this this to a table containing real
calendar dates in SaleDate:

SELECT yourtable.*,
FiscalDates.Fyear, FiscalDates.FMonth
FROM yourtable
INNER JOIN FiscalDates
ON yourtable.SaleDate >= FiscalDates.Start
AND yourtable.SaleDate <= FiscalDates.End

This will have the added advantage that you can adjust the dates for
holidays.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top