Query math

  • Thread starter Thread starter Stephanie
  • Start date Start date
S

Stephanie

Hi. After lots of help from many helpful Discussion Group folks, I have:

[LoggedDate] BETWEEN [forms]![frQuick]![StartDate] AND
[[forms]![frQuick]![EndDate]
"Q" & ([LoggedMonth]+2)\3
DatePart("m",[LoggedDate])
[LoggedYear] -currently have this hard coded as 2009

Which all gives me the current quarter.

Now I would like to be able to determine the previous quarter so that I can
have a trend analysis from one quarter to the previous quarter.

I'd appreciate your suggestions.
Thanks,
Stephanie
 
Since

Datepart( "q", someDate)

returns the 'quarter' of the said date, you can GROUP BY on the computed
expression:


SELECT Year(dateTimeField), DatePart(""q", dateTimeField),
SUM(amount),
AVG(amount),
STDEV(amount)
FROM somewhere
GROUP BY Year(dateTimeField), DatePart(""q", dateTimeField)



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Query summing on one line 4
Date calculations 11
Parameter date format 7
Union query - sort of 4
Query with count, but what am I counting?! 4
"negative" query 4
Make a table query 1
Fiscal Period Definition 4

Back
Top