Calculation from query

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a query which gives me total records in the query and also
totals for each category type. I need an expression which will give
me a percentage. (category type) / (total records). can this be done
in an expression?
 
On Sun, 23 Aug 2009 18:18:29 -0700 (PDT), Jim <[email protected]>
wrote:

Here is one way, using A2007's Orders table. As you can see I used the
DCount function to get the overall total, and a groupby query to get
the total per category (CustomerID in this case).

SELECT Orders.[Customer ID], Count(Orders.[Order ID]) AS [CountOfOrder
ID], Count([order id])/DCount("[Order ID]","Orders") AS Percentage
FROM Orders
GROUP BY Orders.[Customer ID];

-Tom.
Microsoft Access MVP
 
Back
Top