Grouping By Year Then By Months

Dec 3, 2007

I have been assigned a task to create a query that gets record from Access database by grouping it by year and then by months.


DATA ILLUSTRATION

date incidents
01/01/2007 2
01/02/2007 3
01/03/2007 4
01/01/2008 1
20/01/2008 1
01/02/2008 1

Based on the above data illustration, what I am trying to do is to get total by year and then break it down by the months

year 2007 total_incident: 9
Jan total_incident: 2
feb total_incident:3
mar total_incident: 4

year 2008 total_incident:3
jan total_incident:2
Feb total_incident: 1


I am using Microsoft Access, but trying to get the result into a web form. Many thanks in advance

View Replies


ADVERTISEMENT

Grouping/Calculating Months

Sep 30, 2006

I have a table which lists rentals, all have start/end dates and a rental fee p.a.

I want to query this table to show rentals that are effective for any part of 2 dates, [Enter Start Date] and [Enter End Date]. The purpose of this query is to calculate rental income between these 2 selected dates.

Now I have this much working, but I want to group all the figures by month, in order to produce a graph to view the rental income by months.... this bit has me stuck....:confused:

How can I group all these records, when I only have 2 dates... for eg, start 01-01-06 and end 31-07-06...
I want to see figures for Jan06, Feb06, Mar06...July06etc... rather than just a single total figure for the entire period...

Any ideas?
Help! I'm completely stuck here and have spent hours searching the internet but haven't found anything suitable...

View 10 Replies View Related

Months Of The Year In Chronological Order

Sep 9, 2005

Hello All

Does any know how to index months of the year in chronological order, such as

Jan
Feb
Mar

Etc.

Regards
Terence
Nairobi

View 14 Replies View Related

Count Months Then Put In Year Columns

Dec 28, 2005

I appologize if this has been posted before I have been searching all afternoon off and on and have not found anything yet. Using Access 2002 SP3 on an Windows XP

:eek: .

I have a table that contains the following

name
effective date
renewal date
monthly premium

I need to calculate the following. If effective date is 10/01/2004 then multiply monthly premium by 3 for a total for 2004. Then if renewal date is 10/01/2005 I need to mulitply the monthly premium by 9 for 2005 total. I have dates that go from 2004 - 2007 I need to be able to calculate total for year by name irregardless of todays date.


Sample expectation (based on above example.)

Name 2004 2005 2006 2007
rr $12,000 48,000 0 0

Thank so much in advance for anyones help.

View 2 Replies View Related

Grouping By Month & Year

Jul 22, 2007

I have another...

How do I group the dates on my query to show only a certain month and year?

View 2 Replies View Related

Counting Number Of Used Months In Each Year Within A Query

May 11, 2012

I have a query to calculate the monthly depreciation for a machine for specific period of time.

My problem is how to get the number of months for each period assuming i want to start from month September 2009 till may 2012.

Attached the data extracted by the query.

I want to calculate the depreciation to be grouped year by year in report.

[TD][TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]

View 3 Replies View Related

Grouping Date By Year And Month In ADP+SQL

Feb 19, 2007

Hi all.

I have chart in ADP project/MS SQL Express and I want to see in chart table (date Field, data field) grouped by year and month: 2005.01, 2005.02, 2005.03....
I try this str = DATENAME(yyyy,date)+ DATENAME(m,date), SUM(data) FROM table GROUP BY DATENAME(yyyy,date)+ DATENAME(m,date) ORDER BY DATENAME(yyyy,date)+ DATENAME(m,date)

problem is with sorting: 2005April, 2005februar,2005,Januar - its sorting not by date, but alpabhetic.

Please, help with other grouping way!

View 2 Replies View Related

Queries :: Date Criteria - Query Previous 12 Months Including Months With No Data

Mar 22, 2013

I currently have a form where users can enter an "End Date", click a button, and it queries the data from 12 months prior to "End Date" entered.

Is there a way to force the query to show all 12 months, even if there are no records for a particular month? For example: if the user enters February 2013 in the date field, I would like the query to return:

March 2012
April 2012
May 2012
June 2012
July 2012
August 2012
September 2012
October 2012
November 2012
December 2012
January 2013
February 2013

...so even if June 2012 has no records, it is included in the query with a value of zero.

This is what I have so far:

WHERE (((Qry_Tbl_Assets.Dte) Between DateAdd("m",-12,[Forms]![Main_screen]![End_Date]) And [Forms]![Main_screen]![End_Date]))

View 2 Replies View Related

HELP: Changing Dates To FY (fiscal Year) And YTD (year-to-date) Values

Apr 25, 2006

I have a huge table with transaction dates. I need to slice and dice
this data (sum, %'s, etc), but group by FY. Our fiscal year is from
7/1 thru 6/1.

For example:
1/8/2004 = FY 2004,
8/12/2004 = FY 2005,
2/3/2006 = FY 2006

THEN . . . . I need to also isolate certain periods, for example July-
March for YTD (year-to-date) analysis and compare YTD of 2006 with that
of 2005.

What do you suggest? Many thanks.

Mehran

View 7 Replies View Related

Sum Of Current Year Minus The Year Of A Date In Past?

Apr 25, 2014

I'm trying to add a couple of fields to the Contact database in Access 2010.

In the Contacts table, I created a field called "Sobriety Date" that has dates formatted like 12/27/1995

I am trying to add a calculated field called "Years Sober" which should be the current year minus the year in the 'Sobriety Date' field (1995 in the example above).

I have been trying to tweak this:

SUM(DatePart("yyyy",[Date]) - DatePart("yyyy",[Sobriety Date]))

but it's not working. Keeps giving me "The expression that you entered is not valid for web-compatible calculated columns"

View 2 Replies View Related

Percentage Of Year Employed - Prior Year

Aug 1, 2005

I trying to figure out how to make this query work. I have a simple database that is being used to show employee employment information - name, hire date, salary, bonuses, etc. Everything is just about done but they want me to show what percentage of the prior year the employee was there. In other words if an employee was hired 4/20/2004 they want me to show the percentage of 2004 they were employed with the company. I've tried just about everything I can think of but nothing seems to give me the right answer. I am also showing the percentage for the current year (2005) and that works ok. Just can't figure out how the calculate it for a prior year.

This is being done in a query and we're using Access 2000.

Any help would be greatly appreciated.

Thanks,

View 6 Replies View Related

Queries :: Determine Date Given Day Of Year And Year

Jul 3, 2014

I have fields [DayOfYear] and [Year] can I somehow produce the dd/mm/yyyy from this. I know how to do it in Excel but the Asscess function Date() is a little different.

I.e. if [DayOfYear] =152, [Year] = 2014 then [Date] = 2/6/2014

View 6 Replies View Related

Year And Date - Show Day Of Year As Three Numbers

Jan 10, 2012

I'm going to try using the year, day of year, hour & minute (24 hour clock) as a report number. It's set up in a field on a table. Right now I have....

Default Value =Format(Now(),"yyyhhnn") 'which works but not exactly how I would like

yy = Last two digits of the year
y = Number of the day of the year (1 to 366) 'can this show three digits all the time?
hh = Hour in two digits (00 to 23)
nn = Minute in two digits (00 to 59)

For instance, right now for Jan. 10th, 2012, 1306 hours the result would be 12101304 which, for all intents and purposes works, but I would prefer the "day of the year" to always be represented by three digits and not just when it hits day 100 of the year.

I would prefer to see 120101304

View 4 Replies View Related

Add 1 Year To Year Part Of Date

Mar 14, 2006

I have a query based on payment date which I have extracted the Year part as a seperate Field StartYear, but I want to now add EndYear which just adds 1 year to the StartDate. e.g. EndYear = StartYear +1. Anyone kow please I know i's proably simple but I keep getting syntax errors.

View 3 Replies View Related

Add Months And Years

Oct 29, 2007

Hello mates, :cool:

I'm a bit confused with date codes. What I'm try to complish here is that how to add years and months from separate fields to text box, where's difference between two dates as an years and months? So basicly first I read year and month values from text boxes to a integer and then I'm going to add them to somewhere at last, but I'll get like 1 year and 14 months for result so, could you hit me with some tips or tricks what I should try out.
I'll approciate your time to help me out with this and thanks for advance. =P

View 1 Replies View Related

Calulating Months

Sep 14, 2006

Hi,
I am trying to create a query that will show data in a rolling four month period. Example: For September, show June through September; for October, show July through October.
I am using a general date format in the field. I can use >DATE() - 120 to get a 120 day period, but that obviously does not give me data for the actual Calendar dates. Is there a better way?


Any and all suggestions will be greatly appreciated.
Thanks in advance,
Jake

View 2 Replies View Related

Disperse Over Months

Sep 15, 2006

Can this be done?

I have a single $ amount and an effective date. I need to take that dollar amount and disperse it out evenly over 12 months. Is it possible to create a query that will create the fields 1/1/2006, 2/1/2006 and enter those amounts?

For example, total savings is $12k and effective date is 2/1/2006. I need to show $1k in each month field in my query from 2/1/2006 through the month of 1/1/2007. I've tried DateSerial and some other methods but I can only get it to give me the divided amount in the effective date column and nothing else. Is DateSerial the way to go?

Thanks,

Toni

View 2 Replies View Related

Calculate Months

Nov 10, 2006

Hello,

I'm trying to calculate months not days between

EX: 1/1/06 to 6/30/06
I tried to use end date (-) begin date, but is only give me the difference in days. What expression do I use to get 6 months?

:confused:

View 2 Replies View Related

> 6 Months Query

Feb 27, 2007

How do I write an expression to pull data greater than six months from a user entered date.

View 3 Replies View Related

Dates Into Months

Oct 18, 2007

The table I want to run the query on has a date in the format of dd/mm/yyyy. I want to be able to run a query so that the user can type in a month and all records with dates in that month will be shown.

I have done this before many years ago but now have a mental block and cant figure it out.

Any help with this would be greatly appreciated

View 3 Replies View Related

Age & Months Rounded Up

Mar 27, 2005

Searched and can't find the specific answer to my age/month question so I hope you will bear with me.

on my form I need to calculate someones age and show it in years & months, then display the age (years & months) in the format 7.5 ( i.e. 7 years 6 months displays as 7.5 ).

I also need to round that figure down to the nearest 0.5 of a year so 7.4 would display as 7 and 7.9 would display as 7.5.

Any help would be very gratefully received.
Cheers
RussG

View 2 Replies View Related

Using Same Data For Different Months?

May 23, 2013

1) I am trying to use the same set of data for different months. I will try to explain...For each month I want to mark the data as "Statement Received" and "Statement Reconciled". I don't want to create a brand new database every month with the same data. The database will become massive too quickly. Is there any way that I can set the date by using the filter date combo box I have created on the frm_SearchMulti form and having a fresh set of data for just April. When May comes around I can create a new date and have a fresh set of data, but still reference April data... I hope I am explaining this okay

2) Would it be possible to add a column into the "SearchResults" ListBox for Statement Received and Statement reconciled? I would want to update it through the text boxes I made directly above it. The buttons right now do not do anything... they are just there for formatting purposes. I want want to be able to select multiple record in the listbox and update them all simultaneously

3) How can I make the "New Account" button actually pull up a new account?

View 1 Replies View Related

DateDiff Fractional Months

Aug 28, 2006

I need to (accurately) calculate a rental period to fractions of a month.
ie) 1/1/2006 to 2/14/2006 would equal 1.5 months.
DateDiff("m",[Start],[End]) returns whole months.
DateDiff("d",[Start],[End])/30 is very close , but not precise.

Is there a way to accurately calculate fractions of a month?

Thanks,

Sup

View 14 Replies View Related

Dates Back 6 Months

Jun 7, 2005

Good morning all,
I currently have the following expression in a query, to go back 6 months from the current date.

Between DateAdd("m",-6,Date()) And Date()

Does anyone know of a way from the current date, go back to the end of the previous month ( 30th, or 31st) then go back 6 months?

hope that made sense.
Thanks
Kevin

View 2 Replies View Related

Crosstab Query For Last 6 Months

Jun 28, 2005

Is there something I can put into the criteria of a date box to only use the last 6 months. I dont want have have to do this type of criteria: >12/1/2004. I want it to just use information from the last 6 months no matter what the current month is. If anyone knows what I am trying to say, please help me out! Thanks

Bowes

View 4 Replies View Related

Subtracting Dates, Getting Whole Months

Dec 12, 2005

I found the following code on this site in a search for a method to subtract two dates ie [Startdate] and [EndDate] and display the result as a whole number. ie 2, 6 etc. This code finds the difference but displays the results as 1 year 5 months 2 days, where I need the equivalent as 17.
Can this code be modified to produce the desired result and if so how would I go about it. Thanks for the help.

Option Compare Database
Option Explicit

Public Function getTimeElapsed(StartDate, Optional EndDate As Date) As String
On Error GoTo Err_Handler

If IsNull(StartDate) Then
getTimeElapsed = "No startdate"
Exit Function
End If

Dim YY As Integer
Dim MM As Integer
Dim DD As Long

' use current day if EndDate is not supplied,
' + 1 makes both days inclusive.
EndDate = IIf(EndDate = 0, Date, EndDate) + 1

MM = DateDiff("m", StartDate, EndDate)
DD = DateDiff("d", DateAdd("m", MM, StartDate), EndDate)

' recalculate if DD is negative.
If DD < 0 Then
MM = MM - 1
DD = DateDiff("d", DateAdd("m", MM, StartDate), EndDate)
End If

YY = MM 12 ' integer division.
MM = MM Mod 12 ' remainder.

getTimeElapsed = YY & IIf(YY < 2, " year ", " years ") & _
MM & IIf(MM < 2, " month ", " months ") & _
DD & IIf(DD < 2, " day", " days")
Exit Function

Err_Handler:
MsgBox Err.Description
Exit Function

End Function

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved