Search code examples
reporting-servicesssrs-2008-r2ssrs-tablixssrs-groupingssrs-2012

How can I add an interactive sorting on expression column in Sql Server Reporting Services Report


Hi I am new to SSRS and I created a form. I also added a couple of column based on expressions. I was trying to sort the table on the basis of an expression column but the option is not available in cell properties - interactive sorting. Can anyone please guide me on how to achieve it. Thanks.


Solution

  • You have two ways of solving this that I can think of. You can either:

    Move your calculated columns to your Dataset

    When you add a dataset to a report, on the Fields tab you have the option to add Calculated Fields. If you add your expression column here, you will be able to use it in the Sort tab of your Tablix just as you would a normal column.

    SSRS Dataset Calculated Field

    OR

    Repeat the expression in the Sort property.

    If you are not able to create your calculated field on your dataset (perhaps if you reference other datasets or do something out of scope), then you will need to duplicate your expression in the Sort tab of your Tablix. (To access this, click anywhere on your table and then right-click on the small grey square in the top left-hand corner of your table).

    SSRS Tablix Sort expression

    If you click Add for a new Sort condition and hit the fx button, you can paste the same expression you used for your column into here and use it to sort your dataset.

    The downside of this is that you're replicating your logic and potentially duplicating work.