Print Page | Close Window

Select Top N, by Sum of Count

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6009
Printed Date: 05 May 2024 at 9:45am


Topic: Select Top N, by Sum of Count
Posted By: bthews
Subject: Select Top N, by Sum of Count
Date Posted: 06 Apr 2009 at 11:49am
I have seen several threads similar to this, but none seem to answer my question:
 
I have a list of Deals that Can be grouped by state.
I want to see a bar chart of the Top 3 states based on the number of deals grouped by state.
 
So my data might look like this:
 
DealId          State
1000            TX
1001            TX
1002            TX
1003            NY
1004            NY
1005            FL
1007            CA
1008            CA
1009            CA
 
 
So my chart should show TX (3), NY (2), CA (3)
 
What is the best way to do this?
I just can't figure out how to use the TOP N function/grouping to accomplish this...
 
Thank you for any suggestions!



Replies:
Posted By: DBlank
Date Posted: 06 Apr 2009 at 1:10pm
Group by state.
Set a summary as a count of DealID at State group level
Go to group sort expert and select sort fot his group by Top N
where n=3
Use this to create your bar chart



Print Page | Close Window