Percentage Occurrence

jcbhydro

Registered User.
Local time
Today, 15:53
Joined
Jul 26, 2013
Messages
187
Good Morning Folks,

I have a very simple query to determine the gender ratio of an associations membership. My SQL code neatly calculates the number of females, viz

SELECT [Mail List].[GENDER], Count([Mail List].[GENDER]) AS TOTAL
FROM [Mail List]
WHERE ((([Mail List].[GENDER])="F"))
GROUP BY [Mail List].GENDER;

However, I wish to present this result as a percentage of total membership.
My main Table has a column titled [Member Name] so my requirement is to produce a calculation of the form "Females"/"Member Name Total" all multipliied by 100.

The problem seems amazingly simple, but I have failed to find the simple solution.
Any help would be appreciated.

jcbhydro
 
Perhaps something like:
Code:
SELECT [Mail List].Gender, FormatPercent((DCount("*","[Mail List]","Gender= '" & [Gender] & "'"))/DCount("*","[Mail List]")) AS PC
FROM [Mail List]
GROUP BY [Mail List].Gender;
 
Thank you Bob,

That is a very neat solution and works perfectly.

Regards,

jcbhydro
 

Users who are viewing this thread

Back
Top Bottom