473,480 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Convert date range into separate months - ideas?

I have a table with projects that have a start date, an end date and
total hours, for example:

Project StartDate EndDate Hours
Plumbing 3/16/07 5/3/07 240
Drywall 2/3/07 3/4/07 94
Electrical 3/20/07 4/4/07 86

What I want is to have a report that shows me how many hours each
month are spent on a particular project, assuming that regardless of
the particular day of the month the project was started or ended, the
project's hours are evenly divided among months (for example, above
Plumbing should be divided evenly among March, April, and May, even
though the project only extends 3 days into May). The Report I
eventually end up with I want to look like this:

Project 2/07 3/07 4/07 5/07
Plumbing 0 80 80 80
Drywall 47 47 0 0
Electrical 0 43 43 43

How do I take a table with start date and end date columns and convert
it into months? I'm dealing with several thousand records, so I really
would like to avoid doing this manually! Thanks for any ideas!

Sep 11 '07 #1
2 4396
i haven't tried it, but you might be able to get the result you want with a
crosstab query, using a formatted StartDate, as

MyDate: Format([StartDate],"m\/yy")

hth
<we***@brawnandfervor.comwrote in message
news:11*********************@y42g2000hsy.googlegro ups.com...
I have a table with projects that have a start date, an end date and
total hours, for example:

Project StartDate EndDate Hours
Plumbing 3/16/07 5/3/07 240
Drywall 2/3/07 3/4/07 94
Electrical 3/20/07 4/4/07 86

What I want is to have a report that shows me how many hours each
month are spent on a particular project, assuming that regardless of
the particular day of the month the project was started or ended, the
project's hours are evenly divided among months (for example, above
Plumbing should be divided evenly among March, April, and May, even
though the project only extends 3 days into May). The Report I
eventually end up with I want to look like this:

Project 2/07 3/07 4/07 5/07
Plumbing 0 80 80 80
Drywall 47 47 0 0
Electrical 0 43 43 43

How do I take a table with start date and end date columns and convert
it into months? I'm dealing with several thousand records, so I really
would like to avoid doing this manually! Thanks for any ideas!

Sep 11 '07 #2
Wow. Thank you, this works beautifully!!

Sep 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3197
by: Graeme Longman | last post by:
Hi everyone, I was wondering if anyone has written some Python code which uses a start date and end date and a given interval (day, month or year) and outputs all the time periods for that range...
4
5338
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
6459
by: Matt | last post by:
I would like to convert a couple informix stored procedures to SQL Server stored procedures. I have no idea how to accomplish this. Here is an example of one of the procedures I need to convert. ...
1
977
by: Brian Jorgenson | last post by:
I am looking for a formula to put in my query to pull data based on the last 3 months. It starts with the current day and will go back 3 months. Here is my wrkflow language for example: ...
9
2403
by: mistral | last post by:
Need help to remove list of days from date script. Need format "June 07, 2006" <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Get today's current date. var now = new Date();
10
38922
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
1
2567
by: Matt | last post by:
Hi all, I have a database with a table storing a list of names, invoice dates, and invoice amounts. What I'm looking to do is to create a sum of the invouice amounts based on a range of...
10
2365
by: kyosohma | last post by:
Hi, I am working on a timesheet application in which I need to to find the first pay period in a month that is entirely contained in that month to calculate vacation time. Below are some example...
2
1231
by: sixstringsk | last post by:
Can anyone here help me with this... I have a date code to display the date 7 days in the future— check it out here : http://hidefsounds.com/date.html The problem is that the day of the month...
0
7041
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7043
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6737
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5336
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4776
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.