Groups | Blog | Home
all groups > sql server reporting services > june 2006 >

sql server reporting services : top 5 values


Benw
6/6/2006 1:14:02 PM
I have a chart that returns many values. I just want it to show me the top 5
values. In other words how can it give me the 5 cities with the biggest
Amarnath
6/6/2006 10:36:01 PM
Try from sql "top 5" to pick up top 5 cities.

Amarnath

[quoted text, click to view]
Steve Dearman
6/7/2006 12:00:00 AM
Just in case you haven't herd of it before it goes:
SELECT TOP (N) "then the rest of your query" where N is the number of
results you want to return.
Make sure your query is sorted by population in decending order so the top
or first 5 entrys are the highest ones.


[quoted text, click to view]

ashvsaod
6/7/2006 12:00:00 AM
Create a filter on the dataset that limits the number of reports to the top
n of 5.
[quoted text, click to view]

Benw
6/7/2006 5:54:02 AM
The thing is, I want it just on my chart. I need all the data to show up in
my detail because I have several charts that arent top 5 in the same report.
So I just want it to show the top 5 in one of my charts. Is that in the
chart filter?

[quoted text, click to view]
Steve Dearman
6/7/2006 3:47:55 PM
I think youll have to have a seperate data source for the chart.
Copy the datasource that you use for the detail and make one the same but
with different name and the top 5 thing in it and use this for the chart, it
shouldn't make it run any slower and you can use the same perameters (if you
have any) for both datasets.
Hope this clears it up.

[quoted text, click to view]

Steve Dearman
6/7/2006 3:53:56 PM
Just a thought, failing this you could try adding a filter to the chart,
Expression the field you want to filter to the top 5 of
Operator should be IN
Value enter in here SQL statement we discussed earlyer with the "SELECT TOP
(5)" in it
[quoted text, click to view]

Tyrone
6/8/2006 9:27:01 AM
Hello,

Taking this a step further is it possible to somehow combine Top's with
groups so you can (in one SQL statment) have (for Example) Top 5 cities per
Country...

Tyrone

[quoted text, click to view]
Kris Kramer
6/13/2006 9:11:03 AM
I'm having a similar problem using this report designer. I want to filter by
the top 8 or so, but when I create a report and then view it, I get an error
saying that it can't compare string and int32 types. I put the field name in
the expression box, choose Top N from the Operator drop down, and put 8 in
the value box. Is that what it expects or am I doing this wrong?

I could make a new sp to pull the top 8 but why do that when there's a
Steve Dearman
6/27/2006 12:00:00 AM
First a quick check just incase its something silly, Try putting =8 in the
box and if not that then ='8'.
You never know when its a silly phrasing thing like that.
If not then maybe you need to do some conversion of the data that your query
is pulling through.

Steve

[quoted text, click to view]

AddThis Social Bookmark Button