Sunday, July 18, 2010

Report Parameters in SSRS 2008

What is Report Parameters in SSRS?
In SSRS, parameters are used to specify the data to use in a report, narrow down your report data for better analysis, connect related reports together, and vary report presentation. Report parameters can be Single-Valued and Multivalued.

Using Parameters in Reporting Services:
The most common use of parameters is to vary report data retrieved by dataset queries. In this scenario, users are prompted for a value or values when they run the report, and the dataset query retrieves only the data that is requested. You can change the report parameter properties in the report design tools to include a valid values list that displays at run time.

You can also create cascading parameters, which retrieve hierarchical data from a data source. I'll explain cascading parameters in my nect post. First I want to explain creating a report parameter in SSRS 2008.

Below are the uses of report parameters:
  • To Control Report Data - by selecting required parameters values to filter the report data.
  • To Control Report Appearance - use parameters to change report appearance using expression-based properties, including conditionally hiding report items and conditionally changing text color.
  • To Connect to Other Reports - use parameters to link to drillthrough reports, subreports, and linked reports.
  • To Select Specific Data Columns - parameters can be used to select specific columns of a table/matrix at run time.
How to create Report Parameters:
Query parameters are added to a dataset query by way of the query designers or the Dataset Properties dialog box. After you create a query with parameters, Reporting Services automatically links query parameters to report parameters with the same name. Below are the steps to create parameters:

To begin, start a new Report Server Project project in Visual Studio 2008 by clicking on Start --> All Programs --> SQL Server 2008 --> SQL Server Business Intelligence Development Studio. Then, from the menu, select File --> New --> Project to open New Project wizard. Now select Report Server Project from Visual studio installed templates and specify Name, Location and Solution Name.

I'll use the solution ctreated in my previous article. I'll use FirstReport.rdl for this example and I'll create a parameter Designation to filter report data for selected designations.

Create a new Data Set for the report parameter. I will add a dataset dsDesignation for Employee's Designation using query
SELECT DISTINCT Desg AS Designation FROM Employee
as shown below:

Now I will add a parameter Designation. In Report Data section, right click on Parameters node and click Add Parameter... as shown below:

In Report Parameter Properties window, enter Name and Prompt of the parameter and select the Data type from dropdown box. For our example, enter Designation in Name and Prompt text boxes and select Text as data type.

Now click on Avaliable Values to set available values for the parameter. Select Get values from a query. Select dsDesignation as Dataset, Designation as Value field and Label field.

STEP 5: Click on Default Values, Select Get values from a query. Select dsDesignation as Dataset, Designation as Value field. Click OK to save changes.

Double click on your main dataset (dsMain) to open Dataset Properties. Now Select  Parameters and click on Add button to map Designation parameter.

Now final step, just add parameter in your query as shown in below snapshot:
WHERE [Desg] = @Designation

Now preview the report to check the action of parameter used:

Note: This article describes onlu about single valued parameter. I'll explain multi-valued parameter in my next article.


  1. I am having trouble with ssrs multivalued parameters. MY question is how can I pass multivalued parametes in using ssrs expression

  2. Your question is a bit unlcear. Do you want to pass the MV parameter in a stored procedure or just want to display the values in report?

    If you just want to display the values then use following expression:


  3. Is the process of creating a drillthrough report off of a SQL query the same as creating a drillthrough report off of an MDX query? I am unable to populate the parameter in my subreport when I click in the chart to drillthrough. I went into Series Properties, Actions and checked Go To Report, selected the correct report and parameter to be passed. When I click on the report, it sends me to the sub report but the parameter on the sub report is blank.


Note: Only a member of this blog may post a comment.