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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to produce different Counts?

Status
Not open for further replies.

rajrev

Programmer
Sep 25, 2003
148
US
Hi All,
I am using Crystal 9.0 and working on one report which needs the count by condtion.

Example:
Detail
Col1 Col2
xxx 10
yyy 30
zzz 50
aaa 20
bbb 90
ddd 37
fff 40

Report Footer
Count1 10-30 = 3
Count2 31-50 = 2
Count3 50+ = 2

Please help me writing a formula for the above counts.

If you need more information please let me know.
Thanks in advance.

MK
 
Is what you are showing as col2 a database field or is it a summary?

-LB
 
Create three running totals, each with an evaluation formula specifying one of the ranges.

An alternative method is to group the data into one of those three ranges, grouping on a formula field that would say something like if Col2 in [10 to 30] then "a) 10-30" else etc. That would allow summary totals or even a crosstab. But it would also change the order in which the account details are shown.

Assuming you want to keep the sequence, a running total should do it. You could also do it with variables, but running totals are simpler once you are used to them.

Right-click on a field and choose Insert to get a choice of Running Total or Summary. Or else use the Field Explorer, the icon that is a grid-like box, to add running totals.

Running totals allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.

Summary totals are cruder, but are based directly on the data. This means that they can be shown in the header. They can also be used to sort groups, or to suppress them. Suppress a group if it has less than three members, say. They default to 'Grand Total', but also can be for a group.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks for the response.

Col2 is a formula field (Calculation).
There is no grouping.
Report Header - Title
Page header - Column info
Detail 1 - Column values
Report footer - Counts for each range.

 
FYI...
The Footer is the needed result. If i am confusing please let me know.

 
Madawc's suggestions should work fine.

-LB
 
You need to put the running totals in the report footer. For the formula, you should be able to check the value in the formula field. If not, duplicate the formula field logic.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Yes. It's working using the Running Total.
Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top