pcnt: Sum(IIf([GradeID]>=3,1,0))/Count(*)*100
I'm tryting to use this expression to give a precentage of GradeId above 3 for each employee ie Janet has 2 out of 11 to give a percentage of 18% howeve the above gives Janet 100%
sql from the query below
I'm tryting to use this expression to give a precentage of GradeId above 3 for each employee ie Janet has 2 out of 11 to give a percentage of 18% howeve the above gives Janet 100%
sql from the query below
Code:
SELECT tblHandswabs.Surname, tblHandswabs.First_Name, tblHandswabs.ShiftID, tblHandswabs.Date, Count(tblHandswabs.HandswabsID) AS CountOfHandswabsID
FROM tblHandswabs
GROUP BY tblHandswabs.Surname, tblHandswabs.First_Name, tblHandswabs.ShiftID, tblHandswabs.Date
HAVING (((Sum(IIf([GradeID]>=3,1,0))/Count(*)*100)>=5) AND ((tblHandswabs.Date)>#1/1/2010#))
ORDER BY Sum(IIf([GradeID]>=3,1,0))/Count(*)*100 DESC;