Link to home
Start Free TrialLog in
Avatar of chrisamuel
chrisamuel

asked on

Quarterly Data

This works to get quarterly data:
Quarter: Format([DateReceived],"yyyy" & "-" & "q")
But I have two problems: The numbers are off by one in Quarter 4 2004 and Quarter 1 2005, and I can't figure out what's going on.
I'm also using this in the where clause in hopes to only show the current 4 quarters for field [DateReceived]:
>=((Date()-Month(Date())+1)-390)
But I'm getting 5 quarters.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image


what do you mean by off by one quarter? can you give example?

also,  from this statement
>=((Date()-Month(Date())+1)-390)
do you want the second day of the month ?

this will give the first day of the month

            DateSerial(Year(Date), Month(Date), 1)

if you want the second day

            DateSerial(Year(Date), Month(Date), 2)

Avatar of chrisamuel
chrisamuel

ASKER

what i meant was the count of a field was off by one in quarter 4 2004 and also off by one in quarter 1 2005. This,
>=((Date()-Month(Date())+1)-390) was in hopes of showing only the current 4 quarters.  I took it from a query grouped monthly and thought it would work.
<what i meant was the count of a field was off by one in quarter 4 2004 >

i still don't understand why you are trying to count the fields. Can you post some data.

show what you are expecting to get and what is missing.
WHERE year(DateReceived) = year(Date()) will limit you to quarters for this year.
WHERE year(DateReceived) = year(Date())-1 will limit you to quarters from last year, etc.
Here's what I'm trying to do:

SELECT Format([DateReceived],"yyyy" & "-" & "q") AS Quarter, Count(ATS_WACH.DateReceived) AS [Leads Received], Sum(IIf([Disposition]="Dead",1,0)) AS [Inactive Leads], Sum(IIf([Disposition] Not In ("ApTaken/Recd Inc","Dead"),1,0)) AS [Active Leads], Sum(IIf([Disposition]="ApTaken/Recd Inc",1,0)) AS [Locked Apps], ([Locked Apps]+[Active Leads])/[Leads Received] AS [Net Conversion], [Locked Apps]/[Leads Received] AS [Actual Conversion], Sum(IIf([Status]="APP",1,0)) AS [Customers In Process], Sum(IIf([Status]="CAN",1,0)) AS [Customers Cancelled], Sum(IIf([Status]="FND",1,0)) AS [Customers Funded], Sum(IIf([Status]="FND",[Curramt],0))/1000000 AS [Loans Funded Dollars], ([Customers Funded]+[Customers In Process])/[Locked Apps] AS [Net App To Fund], IIf([Locked Apps]=0,0,([Customers Funded]/[Locked Apps])) AS [Actual App To Fund], IIf([Leads Received]=0,0,(([Customers Funded]+[Customers In Process])/[Leads Received])) AS [Net Lead To Fund], IIf([Leads Received]=0,0,([Customers Funded]/[Leads Received])) AS [Actual Lead To Fund]
FROM ATS_WACH
WHERE ((([ATS_WACH].[DateReceived])>=((Date()-Month(Date())+1)-390)))
GROUP BY Format([DateReceived],"yyyy" & "-" & "q");

GrayL, I was trying to get the 4 current quarters, so as of right now, I would need two quarters from last year and the two current quarters from this year and for some reason I'm getting 5 quarters...
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial