473,548 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

obtaining and then grouping by week no's

I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter
Nov 13 '05 #1
5 3025
Peter Bailey wrote:
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

Format(Date, "ww")
--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #2
"Peter Bailey" <pe*********@an daluz.fsbusines s.co.uk> wrote in message news:<cg******* ***@newsg3.svr. pol.co.uk>...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

=============== =============== =============== =============== ==============
Hi!
I'm not sure if this can help you, but this query:

SELECT
tblOrders.Invoi ceID,
DatePart("yyyy" ,[MyDate],1,0) AS MyYeaR,
tblOrders.MyDat e,
tblCust.Custnr,
tblKunder.First Name,
Format(Sum([Price]*[Amount]),"Standard") AS Sales

FROM
(tblCust INNER JOIN tblOrders ON tblCust.CustID = tblOrders.CustI D)
INNER JOIN
tblOrderDetails ON tblOrders.Invoi ceID = tblOrderDetails .InvoiceID

GROUP BY
tblOrders.Invoi ceID,
DatePart("yyyy" ,[MyDate],1,0),
tblOrders.MyDat e,
tblCust.Custnr,
tblCust.Name

HAVING
(((DatePart("yy yy",[MyDate],1,0))=[TELL ME WHAT YEAR]))

ORDER BY
tblOrders.MyDat e DESC;

produces the nicest report I've ever made.
The report is then having an unbound textbox in the toptext for MyDate:
=Format$([MyDate];"mmmm" & " yy";0;0)

and is being sorted:

MyDate DESCENDING;
Custnr ASCENDIND;

and the report will list all activity within each month, nicely output like:

AUGUST:

2004.05.01 Anka Paul 1250:- EUR
2004.05.06 Smith Gold 975:- EUR

and so on...

Hope this can help you!

Me.Name
Nov 13 '05 #3
"Peter Bailey" <pe*********@an daluz.fsbusines s.co.uk> wrote in message news:<cg******* ***@newsg3.svr. pol.co.uk>...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?
You don't. You create an expression to group on.
=Format$([SomeTime],"ww",0,0)
Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.
?datediff("ww", #1/1/04#,date) <-- Today's Date.
33

So query 1 gets the differences in weeks, and then the second does the
grouping. Or you could do it in a report.
I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

Nov 13 '05 #4
I wanted something more like this :

I have a qry that returns the number of bookings on any particular day
excluding saturday and sundays.

[date] [Num_of Bookings] [Day of week]

04/04/04 10 Monday
05/04/04 5 Tuesday
06/04/04 6 Wednesday
07/04/04 0 Thursday
08/04/04 3 Friday

11/04/04 10 Monday
12/04/04 7 Tuesday
13/04/04 3 Wednesday
14/04/04 2 Thursday
15/04/04 1 Friday
What I would like is a 4th Column titled week number that will allow me to
attach the week number (it could be any number) so that I can group on week.
ie the first set of dates here 4th to the 8th would show lets say week 1 and
then the second set of dates 11th to 15th would show week 2. unless I can
extract the natural week number of that week during the year.

04/04/04 10 Monday 1
05/04/04 5 Tuesday 1
06/04/04 6 Wednesday 1
07/04/04 0 Thursday 1
08/04/04 3 Friday 1

11/04/04 10 Monday 2
12/04/04 7 Tuesday 2
13/04/04 3 Wednesday 2
14/04/04 2 Thursday 2
15/04/04 1 Friday 2

I would then be able to create a new query to get the sum of booking for
each week by grouping on the week number column.

Regards in advance and my apologies for not being so clear.
"Peter Bailey" <pe*********@an daluz.fsbusines s.co.uk> wrote in message
news:cg******** **@newsg3.svr.p ol.co.uk...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond basic date calculations.

Regards in advance

Peter

Nov 13 '05 #5
That last post was fantastic my apologies for sending my post as the
datediff code worked a treat with a little tweaking.

Thank you so much for responding so quickly.

Regards
Peter
"Peter Bailey" <pe*********@an daluz.fsbusines s.co.uk> wrote in message
news:cg******** **@newsg3.svr.p ol.co.uk...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

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 friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond basic date calculations.

Regards in advance

Peter

Nov 13 '05 #6

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

Similar topics

2
4544
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 --------- --------- 10/02/04 2
3
2719
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 reports at the plan (overall totals), department and division levels which have sorting and grouping implemented with this new
3
5857
by: Bob | last post by:
I wish to group data on a report by week, month and year. Crystal reports has this ability as a built in function. Is there a quick way to do this in Access97/2000 VBA reports ? Thank you in advance, Bob.
11
7602
by: Karl O. Pinc | last post by:
Hi, What's the best way to obtain the Julian day from a postgresql date? PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) I'm doing some date arithmetic with 1 day intervals and want to, for example, round to the even Julian day. I suppose
5
9092
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 looks like UserName, Date, Project, Hours.
7
9032
by: derekdeben | last post by:
Hi, I have created a report that totals the number of days it took a product to ship by percentage by a date range for a specific location. My data comes from a query with the following headers: I used a count iff to calculate the following headers in the report. This is a percent of the total number of packages.
2
1585
by: egrill | last post by:
I need to be able to group date field by week. I can identify the week but I need to translate the ww into a date. For example; if the date falls in the 5th week of the year, I want to group all the dates that fall in week (jan 28 though the Jan 31) all together. Does anyone have work around solution or know what functions I could use in a...
4
2279
by: ElTipo | last post by:
Hello People, As I can obtain data with a dated fixed criteria. Without utilizing a parameter. Example: My field is . I need a criteria that indicate me a range date on Tuesday of the previous week to Monday of the current week.
6
1636
patjones
by: patjones | last post by:
Good afternoon: This seems like it shouldn't be hard, and then again this is how so many problems seem at the outset. My situation is this: I have a report called rptMain319, which is based on a table tblMain319. The report groups employees by their work location (). By putting a Count(*) function in the footer for the Payroll Distribution...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7444
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7954
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5367
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
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 we have to send another system
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.