Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question about Count / Sum

Status
Not open for further replies.

Toxodont

IS-IT--Management
Jul 12, 2002
52
CA
How do I count all the records in a database field?

I want my report to appear like this for example:

NO. Value
Single Unit Res: 12 117000

------> The values 12 and 117000 would be counts / sums from database fields.

I know it's a stupid question but, I'm a newbie in CR so any help would be greatly appreciated.

Toxodont
 
It's far from a stupid question. Any question is hard if you don't know the answer...

Put the field you want to count in the details section. Right click the field, select Insert/Grand Total (if you want the totals to appear at the end of your report)/Select Sum or Count.

If you want the total to reset at every group level, then choose SubTotal instead of Grand Total and choose which group you want to reset at.

That's it.

Good luck,

Naith
 
Thanks for the reply Naith :)

I did what you told me but for some reason but I'm not getting the results I'm looking for.

NO. Value
Single Unit Res: 12 117000
Multi-Unit Res: 04 49600

Here is some more details that may help you understand the problem better. Take the above example of what I want the report to look like:

Those 4 values are supposed to be counts (total NO. of records) and sums (total value from records) from fields in a database table. When I use grand-total it only shows data at the footer (and it only shows the 1rst record for some reason too). Subtotal will show up in the correct spot above but it only works for sum, not count, and it also shows only the 1rst record as well.

If that makes any difference then could you tell me what I should be doing to make it work the right way.

Thanks for all your help too, it's greatly appreciated!!!

Toxodont
 
Okay, let's understand how your report is working here:

In order to get a count and sum of your fields, your field should be in the a section of the report which will get processed multiple times. Usually, the details section.

Once you place your field in the details section, right click on it and follow the steps I gave you in my preceding post. The totals should then appear in the sections where the totals should be evaluated.

Additional ways to count fields are using the Count or DistinctCount functions.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top