Sdílet prostřednictvím


Add a Filter to a Dataset (Report Builder and SSRS)

Add a filter to a dataset to limit the data in a report after the data is retrieved from an external data source. When you add a filter to a dataset, all report parts or data regions use only data that matches the filter conditions.

For a shared dataset, a filter that applies to all dependent items must be part of the shared dataset definition on the report server. A report or report part that contains an instance of a shared dataset can create an additional filter that applies only to the instance.

To add a filter, you must specify one or more conditions that are filter equations. A filter equation consists of an expression that identifies the data that you want to filter, an operator, and the value to compare to. The data types of the filtered data and the value must match. Filtering on aggregate values for a dataset is not supported.

Note

You can create and modify report definitions (.rdl) in Report Builder and in Report Designer in SQL Server Data Tools. Each authoring environment provides different ways to create, open, and save reports and related items. For more information, see Designing Reports in Report Designer and Report Builder (SSRS) on the Web at microsoft.com.

To add a filter to a shared dataset

  1. Open a shared dataset in shared dataset mode.

  2. On the Home tab, in the Shared Datasets group, click Datasets. The Dataset Properties dialog box opens.

  3. Click Filters. This displays the current list of filter equations. By default, the list is empty.

  4. Click Add. A new blank filter equation appears.

  5. In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.

  6. From the list box, select the data type that matches the type of data in the expression you created in step 5.

  7. In the Operator box, select the operator that you want the filter to use to compare the values in the Expression box and the Value box. The operator you choose determines the number of values that are used from the next step.

  8. In the Value box, type the expression or value against which you want the filter to evaluate the value in Expression.

    For examples of filter equations, see Filter Equation Examples (Report Builder and SSRS).

  9. Click OK.  

To add a filter to an embedded dataset or a shared dataset instance

  1. Open a report in report design mode.

  2. Right-click a dataset in the Report Data pane and then click Dataset Properties. The Dataset Properties dialog box opens.

  3. Click Filters. This displays the current list of filter equations. By default, the list is empty.

  4. Click Add. A new blank filter equation appears.

  5. In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.

  6. From the drop-down box, select the data type that matches the type of data in the expression you created in step 5.

  7. In the Operator box, select the operator that you want the filter to use to compare the values in the Expression box and the Value box. The operator you choose determines the number of values that are used from the next step.

  8. In the Value box, type the expression or value against which you want the filter to evaluate the value in Expression.

    For examples of filter equations, see Filter Equation Examples (Report Builder and SSRS).

  9. Click OK.  

See Also

Tasks

Add a Filter (Report Builder and SSRS)

Reference

Expression Examples (Report Builder and SSRS)

Concepts

Add Dataset Filters, Data Region Filters, and Group Filters (Report Builder and SSRS)