It is possible to do something like this in a query. It would require a
sub-query to do so.
SELECT Sales/
(SELECT Sum(Sales)
FROM YourTable as Tmp) *100 as PercentCalc
FROM YourTable
Of course that works over the entire table and you are probably more
interested in doing this for specific sets of data. For instance for the
year 2007 and by store
SELECT YourTable.StoreId
, Sales/
(SELECT Sum(Sales)
FROM YourTable as Tmp
WHERE Tmp.SalesDate Between #1/1/2007# and #12/31/2007#
AND Tmp.StoreID = YourTable.StoreID) *100 as PercentCalc
FROM YourTable
WHERE SalesDate Between #1/1/2007# and #12/31/2007#
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
Robbie Doo said:
Is it possible to use the following expression that is used in reports on
queries?
=[Sales]/Sum([Sales])*100
Or some expression to get the result.
Thank you.