473,414 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Grouping by weeks

Hi All,

I have the following situation:
I admin a metrics database that includes an attendance piece that
collects hours worked. From this data I show overtime as any amount
of hours over 40 for a particular week.

To do this I have created a table with 4 fields ... Date, week, month,
year. This way I can join on the Date field and then group on year,
week and month. The problem is I must enter data a few times a year
so that this method will continue to work.

My question:
Is there a built in function to handle something like this. I am sure
I could create a function to do this, but was curious as to how others
handle this. What do you guys do in this situation?

Aug 6 '07 #1
3 1766
Create a static table populated with all the date buckets or slices you
will ever need and then join to this table in your queries

Matt wrote:
Hi All,

I have the following situation:
I admin a metrics database that includes an attendance piece that
collects hours worked. From this data I show overtime as any amount
of hours over 40 for a particular week.

To do this I have created a table with 4 fields ... Date, week, month,
year. This way I can join on the Date field and then group on year,
week and month. The problem is I must enter data a few times a year
so that this method will continue to work.

My question:
Is there a built in function to handle something like this. I am sure
I could create a function to do this, but was curious as to how others
handle this. What do you guys do in this situation?
Aug 6 '07 #2
Thanks to both of you ... I am actually doing what John had suggested,
but I like the thought proposed by Larry.

I knew about the datepart function, but did not do enough research to
find the week argument.

Aug 6 '07 #3
"John Winterbottom" <jo*****@rogers.cawrote
An added bonus of the bucket table idea is that it
fills in the gaps, so that time slices for which no
data exist are still reported.
I have used a similar construct for the purpose you describe, but it was not
clear this was a requirement.

As I usually have an idea of the environment for which I am designing a
solution, I am less focused, perhaps, on having a universally-applicable
approach.

This is one of those cases where a stored procedure might be useful if using
an Access client to a server DB.

(P.S. A try at communicating by e-mail to the address above was
unsuccessful.)

Larry Linson
Microsoft Access MVP
Aug 7 '07 #4

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

Similar topics

1
by: amber | last post by:
Hello, I have a report in VB.NET/Crystal Reports. I have a criteria form that users select between 2 different types of grouping (group by category or group by year). Can I programmatically...
2
by: Alicia | last post by:
Hi, I am trying to group by week and do a count of my data in between the dates. In Microsoft Access. Something similar to Before: Date Count --------- ---------...
5
by: Alicia | last post by:
Yes, but will that skip a week and group by the date for me? I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date ...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
5
by: Peter Bailey | last post by:
I have a query that returns , and : 12/05/04 3 Wednesday 13/05/04 0 Thursday and so on what I would like to do now is count the number of bookings by week so from monday to...
1
by: John | last post by:
I'm building a report where each row represents one month and its 1 to 5 weeks. A report query groups the source table date into a "month and year" expression. A subreport links to the main report...
1
by: Andrew | last post by:
All, Apologies if off topic. I'm new to .net, although an experienced programmer, and am working on the client end of a sql application. It holds every single request that goes through our...
5
by: Hemant Shah | last post by:
Folks, We have table that cointains timesheet entries for the employees. Given user name, start date, and end date I want to get sum of hours for each project, for each week. Exmaple: Table...
1
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
0
by: Roman Bertle | last post by:
Hello, I try to format monetary values using the locale module, python2.5: Python 2.5.2a0 (r251:54863, Jan 3 2008, 17:59:56) on linux2 Type "help", "copyright", "credits" or "license" for...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.