Question : YTD Query breakdown by week for all weeks.

I need some assistance in creating a YTD query that will be able provide numbers of candidates in a particular phase.

My previous attempt produced a "completion" count versus a status count. Let me explain.

If we were to track a candidate that entered the system on the 2nd week of the year, but did not complete qualifications until the 1st week of feb, my numbers looked like this.
( Using the fields: [ApplicationDate] and [QualCompletedDate]  )

Week Ending | Candidates
01/07/2005 | 0
01/14/2005 | 0
01/21/2005 | 0
01/28/2005 | 0
02/04/2005 | 1
02/11/2005 | 0

So from the result, I know when the candidate completed Qualifications. But I really need to know the phase that the candidate was in PreQual. The numbers should instead look like this:
Week Ending | Candidates
01/07/2005 | 0
01/14/2005 | 1
01/21/2005 | 1
01/28/2005 | 1
02/04/2005 | 0
02/11/2005 | 0

Please let me know if you need any further clarification.

Answer : YTD Query breakdown by week for all weeks.

jazzmoney,

This is kind of ugly, but now it's calculating correctly.  It uses [Year] as a parameter, and the WHERE cluase should
eliminate the null behavior you were seeing:

SELECT CDate(DateSerial([Year],1,1)-1+7*IIf(Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7)<>([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7,1+Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7),Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7))) AS myDate, Count(CandidateTracking.QualCompletedDate) AS myCount
FROM CandidateTracking
WHERE (((Year([QualCompletedDate]))=[Year]))
GROUP BY CDate(DateSerial([Year],1,1)-1+7*IIf(Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7)<>([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7,1+Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7),Int(([QualCompletedDate]-(DateSerial([Year],1,1)-1))/7)));


Regards,

Patrick
Random Solutions  
 
programming4us programming4us