Friday, October 2, 2015

Sorting in SSRS 2014



In SQL Server Reporting Services, Sorting is similar to SQL ORDER BY Clause. Sorting is used to Sort the records as per the given Expression in Tablix properties and then Sorted data will be displayed in the final SSRS Report.
In this article we will show you, How to Sort the data at Table level (or tablix level) in SQL Server Reporting Services 2014 with example.
TIP: It is always better to apply Sorting at Texbox level (Interactive Sorting) only because it will allow the user to dynamically sort the records.
We are going to use below shown report to explain, Sorting the data at Tablix level. Please refer SSRS Table Report article to understand the Data Source and Dataset we used for this report. If you observe the below screenshot, It was a normal report with Product Name, Color, Sales Amount and Tax Amount columns.
Sorting in SSRS 2014
If you observe the above screenshot, it is displaying the data in a unsorted manner.

Sorting data at Tablix Level in SSRS 2014

Select the Top Left Corner of the report and Right click on it will open the context menu. Please select the Tablix Properties.. option from it
Sorting in SSRS 1
Once we click on the Tablix Properties.. option, a new Tablix Properties window will be opened. Please select the Sorting tab as shown in below screenshot.
Sorting in SSRS 2
Click on the Add button will display the below properties
  • Sort by: It will allow you to select the available Column from the Dataset or we can create our own Expression by clicking the fx button. For instance, If you want to sort the data by Product Name then select that column name.
  • Order: By default A to Z is selected as Order type. You can change as per your requirement. A to Z means Ascending Order and Z to A means Descending Order
Sorting in SSRS 3
In this example, We are going to Sort the records by [English Product Name] in the Ascending Order so, Please select the [English Product Name] as Sort By Expression and A to Z as Order.
Sorting in SSRS 4
Click Ok button to finish configuring Sorting at Tablix Level. Let us Preview the Report
Sorting in SSRS 5
If you observe the above screenshot, data is sorted by the Product Name in the Ascending Order.
Let us add one more Sorting option at Tablix level, for better understanding. Here, We are going to Sort the data by [Sales Amount] in Descending Order and then sort by [English Product Name] in the Ascending Order.
Sorting in SSRS 6
TIP: If you want to delete the unnecessary Sorting Options, Please select the Sort Condition and click on the Delete button.
Click Ok button to finish Applying Sorting at Tablix Level. Let us Preview the Report
Sorting in SSRS 7
If you observe the above screenshot, Data is Sorted by the Sales Amount in Descending order and then sorted by English product name in the Ascending order.
Thank You for Visiting Our Blog