We help IT Professionals succeed at work.

Can anyone please provide a small example of Top N in Crystal Reports?

2,431 Views
Last Modified: 2010-12-13
I can easily find out what top n does in crystal reports on google. The problem is I can't find any examples of how it is used.

Can you please provide a  tiny tutorial or example of how Top N works? Thanks.
Comment
Watch Question

MIKESoftware Solutions Consultant
CERTIFIED EXPERT
Top Expert 2006

Commented:
Top N ...just groups together the TOP NUMBER.....of a group.

For example...if your report shows the following:

CUSTOMER     INVOICE COUNT
100                 1000
101                   50
102                 2002
103                   2
104                   7
105                   10


Then you could use TOP N to sort the groups in  TOP 5 CUSTOMERS and include an OTHERS category like this:

CUSTOMER           INVOICE COUNT
102                       2002
100                       100
101                        50
105                        10
104                        7
OTHERS                 2

Hope it helps..MikeV
MIKESoftware Solutions Consultant
CERTIFIED EXPERT
Top Expert 2006

Commented:
You can do any TOP number.....Top 10, Top 100...etc...etc...
MIKESoftware Solutions Consultant
CERTIFIED EXPERT
Top Expert 2006

Commented:
You can also use the DESCENDING which would be BOTTOM NUMBER....TOP 3 DESCENDING =

CUSTOMER           INVOICE COUNT
103                             2
104                             7
105                              10
OTHERS                      2152

Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
You have to choose a field to do the top 5 on.  In the case above the field used was Invoice count.

So long as the recordset can be sorted on the field you can use TOP N to select the TOP  N records.

mlmcc

Commented:
I have a list of about 500 medication names that I want to show only the top 100 prescribed.  My report looks like this

RX Name             RX Route
Actos                  Oral
Advair Diskus     Inhalation
etc....

I want to show the top 100 drugs used in our clinic.

               
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
WHat defines the order for top 100?

mlmcc
Software Solutions Consultant
CERTIFIED EXPERT
Top Expert 2006
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Forced accept.

Computer101
EE Admin

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.