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!

Counting Formula Fields 3

Status
Not open for further replies.

gtgren

MIS
Jan 31, 2003
116
US
Example:
I have established a Formula Field named Y-N. This field consist of "Yes" and "No". How do I count the "Yes" and "No" within groups and do other calculation such as a grand totals of all the "YES" or "NO".
Thanks
 
Use running totals and evaluate using a formula such as:
(Basic syntax but you can use Crystal syntax also)

If {@Y-N} = "Yes" Then
Formula = True
Else
Formula = False
End If

You can setup the running total to reset at group footer or never reset for grand totals.



 
I'd create 2 formulas, one for Yes, and one for No.

//Yes Formula
{@Y-N} = "Yes"

//No Formula
{@Y-N} = "No"

Now you can place these into the Details section, right click, select Insert->Summary->Count

And select Insert Summary for all Groups and Insert Grand Totals.

Now delete the formulas from the detail.

A simpler approach with the Running Totals and evaluate use a column would be:

//RT1
{@Y-N} = "Yes"

//RT2
{@Y-N} = "No"

With each doing counts.

-k kai@informeddatadecisions.com
 
You could also put small cross-tabs in the group footer, and the report footer. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Thanks I not understand if I have a formula with two choices but what if I have multiple choices, for instance below. What would be the most efficient way to count each one of these that would start over with each group. I understand running totals would accomplish recounting with each new group, but how would I count all the "Gulf Coast", "South Central", etc..within group.

WIA_AREA Formula
if {ITAACT.WIA_AREA} = "28020" then "GULF COAST" else
if {ITAACT.WIA_AREA} = "28070" then "SOUTH CENTRAL" else
if {ITAACT.WIA_AREA} = "28055" then "HINDS COUNTY" else
if {ITAACT.WIA_AREA} = "28080" then "TWIN DISTRICTS" else
if {ITAACT.WIA_AREA} = "28075" then "SOUTH DELTA" else
if {ITAACT.WIA_AREA} = "28903" then "MESC" else
if {ITAACT.WIA_AREA} = "28065" then "THREE RIVERS" else "ERRORS"
 
I would use a Cross-tab in the Group Footer.
Use this formula as either the row field or the column field - depending on if you want the cross-tab to go across or down. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top