473,888 Members | 1,529 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 3044
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
4557
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
2756
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
5880
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
7674
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
9152
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
9054
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
1600
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 query or report. I have done with using the Monthname function but can't find a similar function for...
4
2293
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
1657
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 grouping, I can get the total number of employees in that particular work location. My problem...
0
9961
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 usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
11182
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10778
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10886
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7148
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4245
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.