473,385 Members | 1,312 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,385 software developers and data experts.

How do I group weekly dates, based on a Calender Table?

I basically wanted something that would do a count of the dates, then
group them by their week name..

BEFORE:

Resource Date Total number of times that date Appeared
(Count)
4/3/03 4
4/4/03 2 (note 4/4/03 showed up twice)
4/9/03 1
4/10/03 7
I WANT TO CREATE THIS RESULT:

Resource Date CountbyWeek
4/7/03 6 (The first week of the month)
4/14/03 8 (second week)

I am basically doing this stuff for charting purposes, so I can create
bar graphs was my data by weeks of the month instead of everyday.

**Is this a simpler way of doing things. I created a Calender in
Excel, 1/1/2004, 1/8/2004/, 1/16/2004, 1/23/2004 etc.. until
1/6/2005. Skipping 7 days throughout the years to indicate weeks. I
imported the table into Access, and I linked the calender date table
to my dates that I would like to count. It is only displaying the
DateCOUNT for the dates that fall on the exact CalenderTable date. I
would like it to include the count of all of the dates that fall IN
BETWEEN the CalenderDate table. But I would only like the Dates from
the CalenderDate Field to display, with the correct count including
the values IN BETWEEN. If anyone could help that would be great.
Nov 13 '05 #1
1 2110
Hi Alicia,

If I've understood correctly, you want to count the occurrences of dates
within a given week number (week1 to 52)?

For example:
You want to know how many cheques (or "checks" for you Americans out
here ) <grin>
you have written by WeekNumber.

SELECT CLng(Format([CheckDate],"ww")) AS WeekNumber,
Count(tblCheckRegister.CheckDate) AS CheckCount
FROM tblCheckRegister
GROUP BY CLng(Format([CheckDate],"ww"))
ORDER BY CLng(Format([CheckDate],"ww"));
Results:
-------
WeekNumber CheckCount
1 3
2 2
3 6
4 2
5 7
6 3
....
-------------------------------------------------------------
Or ... is it that you want to return the "WeekOfMonth" (Week 1 to 5)?

If so, have a look at some code written by Kurt A. Fisher ...
(the GetWeekNumberInMonth() function in particular.)
http://groups.google.ca/groups?q=Wee...gcy.com&rnum=2

SELECT Format(([CheckDate]),"mmm") AS CheckMonth, "Week: " &
GetWeekNumberInMonth([CheckDate]) AS CheckWeek,
Count(tblCheckRegister.CheckDate) AS CheckCount
FROM tblCheckRegister
GROUP BY Format(([CheckDate]),"mmm"), "Week: " &
GetWeekNumberInMonth([CheckDate]), Month([CheckDate])
ORDER BY Month([CheckDate]);

Results:
-------
CheckMonth CheckWeek CheckCount
Jan Week: 1 3
Jan Week: 2 2
Jan Week: 3 6
Jan Week: 4 2
Feb Week: 1 7
Feb Week: 2 3
....
--
HTH,
Don
=============================
E-Mail (if you must)
My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================


"Alicia" <al******@hotmail.com> wrote in message
news:d3**************************@posting.google.c om...
I basically wanted something that would do a count of the dates, then
group them by their week name..

BEFORE:

Resource Date Total number of times that date Appeared
(Count)
4/3/03 4
4/4/03 2 (note 4/4/03 showed up twice)
4/9/03 1
4/10/03 7
I WANT TO CREATE THIS RESULT:

Resource Date CountbyWeek
4/7/03 6 (The first week of the month)
4/14/03 8 (second week)

I am basically doing this stuff for charting purposes, so I can create
bar graphs was my data by weeks of the month instead of everyday.

**Is this a simpler way of doing things. I created a Calender in
Excel, 1/1/2004, 1/8/2004/, 1/16/2004, 1/23/2004 etc.. until
1/6/2005. Skipping 7 days throughout the years to indicate weeks. I
imported the table into Access, and I linked the calender date table
to my dates that I would like to count. It is only displaying the
DateCOUNT for the dates that fall on the exact CalenderTable date. I
would like it to include the count of all of the dates that fall IN
BETWEEN the CalenderDate table. But I would only like the Dates from
the CalenderDate Field to display, with the correct count including
the values IN BETWEEN. If anyone could help that would be great.

Nov 13 '05 #2

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

Similar topics

0
by: jason | last post by:
Hi Everyone, I would really appreciate some thoughts on how best to tackle an availability calender in ASP for our yacht fleet. I need to be able to show the booking STATUS of a particular...
24
by: PromisedOyster | last post by:
Is there a way that I can get a resultset that contains unique dates in a given date range without the need to have a temporary table and a cursor? perhaps something like: declare @start_date...
4
by: Alicia | last post by:
I am having a problem grouping by week. I am looking for the simpliest way of doing it in Microsoft Access. I have tried to use a pre-loaded calender, access did not like it at all. If there is...
0
by: ambelkar | last post by:
hi, I trying to join weekly & daily tables by using end_dte,Rpt_dte respectively.My week is saturday to friday.first table only having week end' dates but the 2 daily table having daily dates .when...
7
by: Lucas_london via AccessMonster.com | last post by:
Hi I have set up a database/tables in Access based on daily timeseries data. However I would like to create two additional columns in the table as a basis to pull the data on a weekly and...
0
by: hiha | last post by:
Hi ! I wanted to change color of dates or encircle them when they are being selected in builtin control MonthCalender in vb2005. I could only make them see in bold font when we select the...
1
by: creative1 | last post by:
Hi Everyone, I need help in one more thing. I my report that I want to print under follwoing criteria: Weekly ---------------- Set start and end date automatically to last week Bi-Weekly ...
7
by: gubbachchi | last post by:
Hi all, In my application I need to display the data fetched from mysql database after the user selects date from javascript calender. I have written the code in which after the user selects the...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.