Calculate

G

Guest

I am trying to calculate percentages in a query based off a total number.
There are two fields Country (Text Field) Individuals (Number Field)


This is what it curerntly looks like.

Country Individuals
Belgium 2
Ireland 1
Scotland 1

For a total of 4 people.

This would be an example that I want to achieve in the query. The percentage
field would tell me the following based on the above numbers.

Belgium 50%
Irland 25%
Scotland 25%

Any ideas would be greatly appreciated.
--
Rose


:

Click to show or hide original message or reply text.
 
M

Michel Walsh

SELECT country, individuals / (SELECT SUM(individuals) FROM
yourTableNameHere)
FROM yourTableNameHere


should do.


You can also do:

SELECT country, individuals / DSUM( "individuals", "yourTableNameHere")
FROM yourTableNameHere


if you prefer.


Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top