Calculating Percentage in Query.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query with the fields

Quantity (Count of ID's), Product, company.

My issue is to calculate the percentage for each company in a query

When I put Quantity/Sum(Quantity)) I am getting subquery warning. How can I
accomlish this in a query.

That is , I would like to get
Quantity, Percenage: Qty/Sum(Qty), Company.

Any help really appreciated.

Thank you
 
Create a totals query to get your SUMs for the equation.
Join the query with your table in that output query to get percent.
 
May be I am mis understanding or I do not know.

I guess When I create totals query I will get the totals. However ho do I
join the two tables?
 
Hello Lin.

Lin said:
I have a query with the fields

Quantity (Count of ID's), Product, company.

My issue is to calculate the percentage for each company in a query

When I put Quantity/Sum(Quantity)) I am getting subquery warning.
How can I accomlish this in a query.

That is , I would like to get
Quantity, Percenage: Qty/Sum(Qty), Company.

Any help really appreciated.

Thank you

How about this:
Select company, Count(ID) as Quantity,
Count(ID)/(Select Count(ID) From YouTableName) as Percentage
From YourTableName Group By company
 
Back
Top