You can try building a nested SQL statement, or sometimes what is
easier to do is to
1. build a query that totals sales by location, this would have the
fields, location and sales (summed)
2. Build a new query with the fields Location, Territory, Sales
(summed),
Add the query in step one and join on Location, then from query one
bring in Total Sales
3. Add an expression that divides the territory sales by the total
location sales to get the percentage, then limit in the criteria to
only the %'s that you are interested in viewing.
Hopefully this helps to accomplish what i think you are trying to do.
AP
www.megacrosstab.com ni*********@gmail.com wrote:
I have a recordset that includes the following data
Location
Territory
Sales
Total Sales
% of total sales
A location can have multiple territories, and each territory has
different sales
I want to retrun only the territories that total 85% of a location's
total sales. I don't want to retrieve the top 85% records.
Can anyone provide guidance on writing such a query or funciton?
thanks.