I am trying to run a query that gives the average number of agents logged in to our system over a given time period. The average number of agents is calculated by taking the TotalStaffedTime field and dividing it by the ActiveTime field so when I created my query I came up with this:



SELECT DISTINCTROW FORMAT(dbo_iSkillsetStat.Timestamp,"hh:00") AS TimestampByHour, Sum(dbo_iSkillsetStat.CallsAnswered) AS [# Answered], Sum(dbo_iSkillsetStat.CallsOffered) AS [# Offered], Sum(dbo_iSkillsetStat.SkillsetAbandoned) AS [# Abandoned], (dbo_iSkillsetStat.TotalStaffedTime / dbo_iSkillsetStat.ActiveTime) AS [AvgNumOfAgents]
FROM dbo_iSkillsetStat
WHERE FORMAT(dbo_iSkillsetStat.Timestamp,"mm/yyyy")=[Date (mm/yyyy)] AND dbo_iSkillsetStat.Skillset="HealthLine_sk"
GROUP BY FORMAT(dbo_iSkillsetStat.Timestamp,"hh:00"),(dbo_iSkillsetStat.TotalStaffedTime / dbo_iSkillsetStat.ActiveTime), dbo_iSkillsetStat.ApplicationID;

When I have the query written like this I get an error saying that "The expression is typed incorrectly or is too complex to be evaluated. ....." but when I remove the portion that is bolded it works right.

Am I doing the division wrong or is it something else altogether?

--Using Access 2002 on Windows XP Pro. The table "dbo_iSkillsetStat" is a linked table if that makes any difference--