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

Top N / Sort

Status
Not open for further replies.

1dgood

Technical User
Sep 3, 2003
2
US
I have a report that lists job cost total by Job Number Grouping on Market Code.

I would like to keep the Market Code Group then ask to give me the top 5 and bottom 5 job cost totals within each Market Code.

I know I can list either Top N or Bottom N, but how can I do both on one field??

Hope someone has an answer.. :)

dgood

 
I tried this before but failed. What I really tried was to print a Top N report that includes everything, but conditionally suppresses the group header, group footer and details sections that are not desired.

I am about 100% sure this is possible, but I never got this done the last time I tried. I believe chelseatech had this in a recent newsletter, check out for details.



Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
I'm assuming Market Code is your group 1 and Job No is your group 2, and that you want to find the bottom and topN of job cost totals by Job No within each Market Code.

First go to topN and choose "All" and select the job cost total field, and then create a running total {#cntwingrp}: Select {table.JobNo}, distinctcount, evaluate for each record, reset on change of group 1 (Market Code). Place this in the Group 1 footer.

Then go to format section->group 2 (Job No) footer->suppress->x+2 and enter:

{#cntwingrp} <> [1 to 5] and
not({#cntwingrp} in distinctcount({table.JobNo},{table.MktCode})-4 to distinctcount(table.JobNo},{table.MktCode}))

-LB
 
lbass - this worked beautifully....thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top