How does one calculate a percentage on the total in a query?

G

Guest

I have two fields’ country (Dropdown Text Field listing Countries) and
Individuals (Number field containing the amount of people from that Country).
Is there an easy way to do a percentage? I.e. How many people overall are
from a particular country?
 
G

Guest

One way will be:

In the form create a text box and in the Control Source of a text box you
can write

= ([Individuals] / DSum("Individuals","TableName")) * 100

The Dsum will return all the Individuals

Or in the query using the same formula (without the equal sign) as a new
field to get the precent for each country

Note: in the form you can set the text box property to percent, that way you
can remove the *100
 
G

Guest

I am not sure I am doing this right because the percentages are not making
sense. This would be an example that I want to achieve in the query.

Country Individuals
Belgium 2
Ireland 1
Scotland 1

For a total of 4 people. 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


Ofer Cohen said:
One way will be:

In the form create a text box and in the Control Source of a text box you
can write

= ([Individuals] / DSum("Individuals","TableName")) * 100

The Dsum will return all the Individuals

Or in the query using the same formula (without the equal sign) as a new
field to get the precent for each country

Note: in the form you can set the text box property to percent, that way you
can remove the *100

--
Good Luck
BS"D


Rose said:
I have two fields’ country (Dropdown Text Field listing Countries) and
Individuals (Number field containing the amount of people from that Country).
Is there an easy way to do a percentage? I.e. How many people overall are
from a particular country?
 
G

Guest

Try this SQL

Select Country, Individuals, (Individuals /
DSum("Individuals","TableName"))*100 As Percentage From TableNAme

You copy that SQL and paste it to query, just don't forget to change the
table name

--
Good Luck
BS"D


Rose said:
I am not sure I am doing this right because the percentages are not making
sense. This would be an example that I want to achieve in the query.

Country Individuals
Belgium 2
Ireland 1
Scotland 1

For a total of 4 people. 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


Ofer Cohen said:
One way will be:

In the form create a text box and in the Control Source of a text box you
can write

= ([Individuals] / DSum("Individuals","TableName")) * 100

The Dsum will return all the Individuals

Or in the query using the same formula (without the equal sign) as a new
field to get the precent for each country

Note: in the form you can set the text box property to percent, that way you
can remove the *100

--
Good Luck
BS"D


Rose said:
I have two fields’ country (Dropdown Text Field listing Countries) and
Individuals (Number field containing the amount of people from that Country).
Is there an easy way to do a percentage? I.e. How many people overall are
from a particular country?
 

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