UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Calculate Total For Each School Year    
 
   
sugarcane
post May 31 2008, 01:11 PM
Post #1

UtterAccess Ruler
Posts: 1,256
From: Canada



Hi There,

I haven't been using access as much as I use to so if this is quite simple, please forgive me.

The code below output the total for each calendar year. What I need is the total for each school year. So it should show the total from September 2006 - August 2007, September 2007 - August 2008, etc...

Thank you in advance.

Here's the Code:

SELECT DISTINCTROW Format$(qryReports.InvoiceDate,'yyyy') AS [InvoiceDate By Year], Sum(qryReports.GrandTotal) AS [Sum Of GrandTotal]
FROM qryReports
GROUP BY Format$(qryReports.InvoiceDate,'yyyy'), Year(qryReports.InvoiceDate);
Go to the top of the page
 
+
theDBguy
post May 31 2008, 04:09 PM
Post #2

Access Wiki and Forums Moderator
Posts: 47,999
From: SoCal, USA



Maybe something like:

SELECT Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1)) As FY, Sum(GrandTotal) As Total
FROM qryReports
GROUP BY Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1))

(untested)
Hope that helps...
Go to the top of the page
 
+
sugarcane
post Jun 2 2008, 08:29 AM
Post #3

UtterAccess Ruler
Posts: 1,256
From: Canada



Untested...but works! Thanks so much.

Just one more question...In the query it shows the year as 2004, 2005, 2006, etc... next to the total
How can I have it show the year like this: Sept. 2004 - June 2005, Sept. 2005 - June 2006.

Thanks again!
Go to the top of the page
 
+
theDBguy
post Jun 2 2008, 12:17 PM
Post #4

Access Wiki and Forums Moderator
Posts: 47,999
From: SoCal, USA



You can try:

SELECT "Sept. " & (Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1)))-1 & " - June " & Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1)) As FY, Sum(GrandTotal) As Total
FROM qryReports
GROUP BY "Sept. " & (Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1)))-1 & " - June " & Year(InvoiceDate)-(InvoiceDate>DateSerial(Year(InvoiceDate),9,1))

(air code)
Hope that helps...
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 02:27 PM