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!

Top N Sum

Status
Not open for further replies.

rydexdba

Programmer
Jul 23, 2001
7
US
I have a report that should not display in Top N format. I would like however, to be able to sum the Top 10 largest incomes from it, even though the report might display 100 employees. The top 10 sum would then be put at the end of the subreport. Is there any way to accomplish this?
 
You could evaluate each sum and hold them in variables or perhaps an array. When the report footer is reached you would sum the "top sums". It may be tedious, but you should be able to get the result you want.

Lisa
 
Yes, an array variable approach could work well.

An alternative, is to use a subreport.

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks for pointing me into the way of a resolution to this problem. I am new to crystal reports though. Any insights into how an array could be used? An example would be greatly appreciated!
 
OK ... I tried the sub-report way and discovered that I can display the top 10 values in a subreport. The Grand Total of these 10 values however is incorrect when I remove the 'Others' checkbox of the TopN Expert. Instead, it gives me a subtotal of all values. I am using Crystal Reports 6.0. Any clues on how to make Crystal Reports display the correct Sum?
 
To get an accurate Grand Total using TopN with no Others you have to use a runnning total. In v6 that means using variables to get the grand total. See faq149-182 for how to do this.

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
 
You might like to consider putting a crosstab into the header or footer sections. Just use a row of your group field, and a summarised field of your summary. No column needed.

The crosstab can do it's own TopN without showing the others. You must select the Crosstab, prior to selecting TopN, and then the TopN is on your Crosstab rather than the groups of your report. Editor and Publisher of Crystal Clear
 
Can you use TopN with a cross-tab in CRv6? I thought that startee with v7? 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