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

How to summarize a "count" field on crosstab report 1

Status
Not open for further replies.

SNewsome

IS-IT--Management
Sep 14, 2004
4
US
Crystal Reports XI

I have a crosstab report that displays the number of citations issued by each district and officer. It also includes what the violations are for (speeding, no tag, etc.). An officer can issue a single citation with multiple violations.:

# Citations Speeding No Tag No Signal
District 50 22 23 35
Employee 25 3 10 5
Employee 10 2 5 8
Employee 15 6 7 11

Each of the number fields above are based on a summary count. I want to add a column on the right that adds the total number of violations (speeding, no tag, etc.).

Is this possible in a Crosstab report? If so, what is the formula and where would I put it?
 
An officer can issue a single citation with multiple violations
Just what's on the record? If there is one record per violation then the crosstab should handle it with its usual row totals. If these are different fields, then I can't see how you've been able to make a crosstab from it.

Depending on what you have, you may need a Mock-Crosstab. This is something that looks like a Crosstab, but in fact you define each column yourself, normally as a running total. This would need to go in the report footer, because running totals count as the reports 'run' and they will not be complete until then. Crystal should have included an example along with the Crosstabs.

You can save a little time by doing a paste to a dummy report, changing the name and then pasting back.

Each running total will count the record if it was within the criteria

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
If you have a field called "violation", insert a summary that is a count of violations, in addition to the one that is a count of citations. You would then suppress the summary in the inner cells. However, this would display next to the count of citations, not at the other end of the crosstab.

-LB
 
I don't have a field called "violation". Each violation (speeding, no tag, no signal, etc.) is a separate field (checkbox).
 
Okay, then select the inner cell and total cell for "speeding"->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar cntx := currentfieldvalue;
false

Repeat for other violations, changing the variable name each time, e.g., to cnty, cntz, etc.

Create a formula {@0} by opening a new formula and entering zero (this is just a place holder). Add this formula as a final (summary in the last position) summary in the crosstab. In preview mode, select the {@0} in the inner cell and total cell, and right click->format field->DISPLAY STRING->x+2 and enter:

whileprintingrecords;
numbervar cntx;
numbervar cnty;
numbervar cntz; //etc
totext(cntx+cnty+cntz,0,"")

-LB
 
This worked perfectly! Thank you so much lbass. I don't know what I would do without the true online experts who are so incredibly helpful.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top