Home > Home > order by paramter value in ssrs report

order by paramter value in ssrs report

From MSDN I got this question order by paramter value in ssrs report.

Based on the parameter selection we will sort the data.

Lets create SSRS report with one parameter name as sortedby

add Values in Available list as shown in below screen

AvilableValues

I Have Sample query with Data as shown in below :-

select * from
(
select 1 monthnumber , ‘Jan’ MonthName, 2013 year,100 SalesValue, 500 SalesVolume
union
select 2 monthnumber , ‘Feb’ MonthName, 2013 year ,200 SalesValue, 400 SalesVolume
union

select 3 monthnumber , ‘Mar’ MonthName, 2013 year , 300 SalesValue, 300 SalesVolume
union

select 4 monthnumber , ‘April’ MonthName, 2013 year, 300 SalesValue, 600 SalesVolume
union

select 5 monthnumber , ‘May’ MonthName, 2013 year, 350 SalesValue, 500 SalesVolume
union

select 6 monthnumber , ‘June’ MonthName, 2013 year,200 SalesValue, 200 SalesVolume
union
select 7 monthnumber , ‘July’ MonthName, 2013 year, 380 SalesValue, 150 SalesVolume
union
select 8 monthnumber , ‘Aug’ MonthName, 2013 year, 100 SalesValue, 250 SalesVolume
union
select 9 monthnumber , ‘Sep’ MonthName, 2013 year, 500 SalesValue, 350 SalesVolume

)t

order by case when @sortedby =1 then SalesValue else SalesVolume end

In Above  SQL query ,case used In ORDER clause is important.

Lets see the Report by running it.

Case 1 Sorted Report  by  Sales Value as shown below:-

SortbySalesValue

Case 2 Sorted Report  by  Sales Volume as shown below:-

SortbySalesVolume

Thanks for visiting my blog

Prasad

Learn Different BI Tools
Subscribe my YouTube Channel : BI Tools

Advertisements
Categories: Home
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: