SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Top 10 (Sorting in a Chart)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ZMike
Yak Posting Veteran

69 Posts

Posted - 01/20/2009 :  13:27:29  Show Profile  Reply with Quote
Hopefully this comes across the correct way.

I'm trying to take our top 10 employees in a chart that would have a sum on sales.

Is there a way without writing a seperate query to sort by the top 10 sales desc in Reporting Services ?

I was thinking that it could be done by either the data tab on the chart, by going to values or by going to filters. However anytime that I type TOP it says unrecognized identifier.

ZMike
Yak Posting Veteran

69 Posts

Posted - 01/20/2009 :  14:37:44  Show Profile  Reply with Quote
Well I'd still be curious to know for future reference but for now I went ahead and made another data set to tie into.
Go to Top of Page

revelator
Starting Member

32 Posts

Posted - 01/21/2009 :  06:24:54  Show Profile  Reply with Quote
I thought this was quite an interesting question, so I've have a go at it this morning, and think I have a solution.

The problem I found when using a filter in the Chart Properties was that aggregates are not allowed in filters at that level. Also, filters cannot be added into the Series Properties for the data fields.

What I did was create a filter on the Category Group Properties in the category field. I set the expression to be the same as the data field (eg Sum(Fields!SalesAmount.Value)). Then set the Operator to "Top N" and set the Value to be a parameter I was using called @TopN. You could also set this to be =10 though. This gave me the results you were looking for, and changing the TopN parameter confirmed this.

I'll look into this in a bit more depth and hopefully get a blog post up about it soon.

Note I've only tested this on SSRS 2008.



-----------------------------------
Waiting for the Great Leap Forwards
Go to Top of Page

revelator
Starting Member

32 Posts

Posted - 01/21/2009 :  06:33:08  Show Profile  Reply with Quote
Forgot to mention, using the same expression in the Sorting tab will allow you to sort the data descending if you choose Order...Z to A.



-----------------------------------
Waiting for the Great Leap Forwards
Go to Top of Page

revelator
Starting Member

32 Posts

Posted - 01/21/2009 :  09:55:11  Show Profile  Reply with Quote
Blogged: http://sqlserver.posterous.com/ssrs-2008-using-the-top-filter



-----------------------------------
Waiting for the Great Leap Forwards
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.03