Sum items by group?

G

Guest

I have a report that shows sales data for books by ISBN. The fields in the
report include "Retail Discount", "Sale Price", and "Quantity". What I need
to do is to sum the quantity sold for each book by discount and sale price.
Although I tried doing this in a query, I was having difficulties because it
was not letting me include fields that were not part of the "domain aggregate
function."

So, my question is, is there a way to do this in a report (possibly by using
sorting and grouping)? I know I can sum the data in the "quantity" field by
using the Sum function, but I really need to be able to Group By discount and
Sale Price. Please let me know if you have any idea how to do this.

Thanks,

Chris
 
D

Douglas J Steele

Whenever you're using aggregate functions such as Sum or Average, every
field in the SELECT portion of the query must either have a function applied
to it, or it must appear in the GROUP BY portion of the query.

Do you have the SQL for the query that was failing?
 
G

Guest

Douglas, it's not that my query is failing, exactly, the problem is that I
need to include more fields in my report than I can include in the query. If
I base my query off the main report without summing the records first, then I
have too many records to fit on one page, whereas if I try to use a domain
aggregate function I can't include all of my fields (because I only want to
Group By Discount, Sale Price, and ISBN, but I need quite a few more fields
for my report).

Would it be possible to base a supreport on the domain aggregate query while
basing the main report on the main table, or is there a better way of doing
this?

I only need to include the data that I need to Sum and Group By in one
section of my report (I was including it in the Detail section), so maybe
that helps.

Please let me know if you can think of a way to do this.

Thanks,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top