SSRS Sort Legend: It can be done!

While working with a stacked bar chart in SQL Server Reporting Services (SSRS), I needed to change the sort order for the legend without changing the sort order of the stacked bar. Despite the fact I personally think stacked bar charts are a poor way to visualize data people still want to use them. Didn't they read my post on charting best practices?!? One of the tricks with a stacked bar chart is that only the bottom value can actually be measured. Thus, we frequently want to force the most important measure to sort to the bottom of the stacked bar. Uh oh! Once you sort the most important measure to the bottom of the stacked bar, the legend will now be sorted with the most important measure on the far right, most likely where the least important value would be described. I was starting to think it wasn't going to be possible to correct this annoyance until I stumbled on a clue in a thread on another site (On SSRS 2008, Why Is The Legend Sorted In Reverse Order?) Most of the suggestions didn't actually change the sort order of the legend without changing the sort order on the chart (again, stacked bar for my example). Buried among the suggestions which didn't work were a few sentences, apparently from Sean Boon of the SSRS Team (Boon Blog), which did the trick.

Instead of right clicking on the legend and looking at the "Legend Properties" as I was want to do. The trick to sorting the legend was in the *other* legend properties window.

1.  Click the legend to select it.

2.  Then press "F4" to open the properties window. (alternatively you can select "Properties Window" from the View menu.)

3.  Within the properties window find the intuitively named attribute "Reversed". There are only three options in SQL Server Reporting Services 2008: "Auto", "True", and "False". Experiment with the True and False settings to achieve the desired effect.

That's it. You are now an SSRS stacked bar legend sorting wizard. Prepare to bring in the big bucks!



By Phil Steffek

Phil Steffek is a professional sumo wrestler who is hoping to represent the U.S. in the next Olympics. During the off season Phil is a Data Architect working on transactional databases, data warehouse implementations, and all aspects of business intelligence. Also, Phil is not really a sumo wrestler. You can get to know a bit more about my non-sumo doings by checking out my LinkedIn Page

Leave a comment

Your email address will not be published. Required fields are marked *