A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query to calculate the percentage



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2006, 11:17 AM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 17
Default Query to calculate the percentage

Hi,

I have a table with field physical damage (number) and this can be
either 0,1 or 2.

I need to calculate the percentage of occurrance for when is 1 and 2.

How should I do that? Can someone help me?

For example.

Physical Damage Percentage
0 0 0%

1 2 66.66%

2 1 33.33%


Cheers!

C

  #2  
Old October 4th, 2006, 01:21 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Query to calculate the percentage

You didn't give much detail on your table structure. Calculating the
percentage for the entire table should look something liek

SELECT [Physical Damage]
, Count([Physical Damage])/(SELECT Count( [Physical Damage]) FROM
[YourTable]) as Percentage
FROM [YourTable]
GROUP BY [Physical Damage]


wrote in message
ups.com...
Hi,

I have a table with field physical damage (number) and this can be
either 0,1 or 2.

I need to calculate the percentage of occurrance for when is 1 and 2.

How should I do that? Can someone help me?

For example.

Physical Damage Percentage
0 0 0%

1 2 66.66%

2 1 33.33%


Cheers!

C



  #3  
Old October 4th, 2006, 01:58 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 17
Default Query to calculate the percentage

I need to calculate the percentage for each "row", not the entire
table.
Let's say that I have 3 rows, I have 1 row with physical damage value =
2 and 2 rows with physical damage value = 1.

So the percentage for physical damage value = 2 should be
CountOfPhysicalDamageValue2/ Count(PhysicalDamage) --- 66.66%

So the percentage for physical damage value = 1 should be
CountOfPhysicalDamageValue1/ Count(PhysicalDamage) --- 33.33%

Cheers!

C


John Spencer escreveu:
You didn't give much detail on your table structure. Calculating the
percentage for the entire table should look something liek

SELECT [Physical Damage]
, Count([Physical Damage])/(SELECT Count( [Physical Damage]) FROM
[YourTable]) as Percentage
FROM [YourTable]
GROUP BY [Physical Damage]


wrote in message
ups.com...
Hi,

I have a table with field physical damage (number) and this can be
either 0,1 or 2.

I need to calculate the percentage of occurrance for when is 1 and 2.

How should I do that? Can someone help me?

For example.

Physical Damage Percentage
0 0 0%

1 2 66.66%

2 1 33.33%


Cheers!

C


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.