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

How do I rank a column in a Crystal Reports Crosstab?

Status
Not open for further replies.

fanhokie

Programmer
Jan 24, 2012
2
US
I want to rank from highest to lowest 31 counties in a crosstab but keep the counties in alphabetical order. Is there any easy way to add a ranking column to their totals?

Crystal Reports Crosstab

County Total Rank
1 200 3
2 500 2
3 100 4
4 700 1
5 50 5

I would like the rank to show up like above but cannot figure out how to do it?

Thanks
C
 
You can do this fairly simply as long as you can also group the report on the same county field - even if the group headers and footers are not shown in the final output. If you need the report to group by something else you could make a subreport that has the cross-tab and is also grouped by that same county field.

Here are the steps:

1) Group the report by County
2) Create the correct subtotal for each County to use for ranking
3) Use the Group Sort expert to rank the groups in the right order
4) Create a formula called "Rank" that is simply the function
GroupNumber and place it on the group footer.
5) Go into the cross-tab and add the "Rank" field as a summarized field, and set the summary to MAX.
5) Suppress the Grand Total cell for this summary field

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Please do not post the same thread in multiple forums. I responded in the other forum with a more complex solution (if you can do a group sort, you should use Ken's solution; if not, try mine).

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top