Getting Percentages In Access
I have a report listing the number of employees that answered specific
questions on a survey and it lists the total population. I am trying to
get the percentages of the answers to the total population but I am having
trouble getting the code to work. So far my code is:
SELECT
Mgmt_Lvl.MGMT_LVL,
Count(O896IA_VEMPPRSA.SYS_EMP_ID_NR) AS Total,
Sum(IIf(emp_rlc_ir="Y",1,0)) AS Relocate,
Sum(IIf(emp_int_asn_ir="Y",1,0)) AS International_Assignment,
Sum(IIf(emp_tvl_ir="y",1,0)) AS Travel,
Sum(IIf(emp_spc_asn_ir="y",1,0)) AS Special_Assignment
FROM (O867IA_VPJOBCO
INNER JOIN Mgmt_Lvl ON O867IA_VPJOBCO.JOB_GRP_CD = Mgmt_Lvl.JOB_GRP_CD)
INNER JOIN (O896IA_VEMPPRSA INNER JOIN O867IA_VCAREER
ON O896IA_VEMPPRSA.SYS_EMP_ID_NR = O867IA_VCAREER.SYS_EMP_ID_NR)
ON O867IA_VPJOBCO.JOB_CLS_CD = O896IA_VEMPPRSA.JOB_CLS_CD
WHERE (((O896IA_VEMPPRSA.EMP_EMT_STS_CD)<>"T"))
GROUP BY Mgmt_Lvl.MGMT_LVL;
The SUM(IIF(... are the counts and the TOTAL is the total population. I
need to get the SUM(IIF( / TOTAL to get the percentages.
No comments:
Post a Comment