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

sql server reporting services : Top 5


Benw
6/7/2006 6:50:02 AM
Here is my scenario. I have a list of problems occurring monthly. What I
want to do is create a graph showing all the months to date and how many
times each problem occurred in that month. But there are way to many for a
graph. SO now what I want to show is the top 5 problems per month. I need
to set the top 5 in the graph and not in the main query because I am using
Benw
6/7/2006 12:00:44 PM
I will give you my query and see if you can help me. But basically I am just
going to make a single chart now instead of having to create a new
datasource. Because I have several charts I would have to do that for. For
the problem codes I have I have to count them and then put them in a group so
i know how many times that problem had an instance. I cant group by the
count so I dont know how to get a Top N out of that. My group is
"problemcode" with a count in the group which is really what I need to group
by. The top(N) right now is giving me me the top 5 from alphabetical order.
Help

[quoted text, click to view]
Steve Dearman
6/7/2006 3:26:55 PM
check the "top 5 values post below, shows how to change the SQL query to
show only the top five results

QUOTE :::::::::::::
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]


[quoted text, click to view]

AddThis Social Bookmark Button