Add a Filter (Report Builder and SSRS)
Add a filter to a dataset, data region, or group when you want to include or exclude specific values for calculations or display. Filters are applied at run time first on the dataset, and then on the data region, and then on the group, in top-down order for group hierarchies. In a table, matrix, or list, filters for row groups, column groups, and adjacent groups are applied independently. In a chart, filters for category groups and series groups are applied independently.
To add a filter, you must specify one or more 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 or data region is not supported.
To filter data points in a chart, you can set a filter on a category group or a series group. By default, the chart uses the built-in function Sum to aggregate values that belong to the same group into an individual data point in the series. If you change the aggregate function of a series, you must change the aggregate function in the filter expression.
For more information about filtering embedded and shared datasets, see Add a Filter to a Dataset (Report Builder and SSRS).
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 set a filter on a data region
Open a report in Design view.
Select the data region on the design surface, and then right-click <data region> Properties. For a gauge, select Gauge Panel Properties. The <data region> Properties dialog box opens.
Note
On a Tablix data region, right-click the corner cell or a row or column handle, and then click Tablix Properties.
Click Filters. This displays the current list of filter equations. By default, the list is empty.
Click Add. A new blank filter equation appears.
In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.
From the drop-down box, select the data type that matches the type of data in the expression you created in step 5.
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.
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).
Click OK.
To set a filter on a Tablix row or column group
Open a report in Design view.
Right-click the table, matrix, or list data region on the design surface to select it. The Grouping pane displays the groups for the selected item.
In the Grouping pane, right-click the group, and then click Edit Group. The Tablix Group dialog box opens.
Click Filters. This displays the current list of filter equations. By default, the list is empty.
Click Add. A new blank filter equation appears.
In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.
From the drop-down box, select the data type that matches the type of data in the expression you created in step 5.
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.
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).
Click OK.
To set a filter on a Chart category group
Open a report in Design view.
On the design surface, click the chart twice to bring up data, series and category field drop zones.
Right-click on a field contained in the category field drop zone and select Category Group Properties.
Click Filters. This displays the current list of filter equations. By default, the list is empty.
Click Add. A new blank filter equation appears.
In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.
From the drop-down box, select the data type that matches the type of data in the expression you created in step 5.
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.
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).
Click OK.
To set a filter on a Chart series group
Open a report in Design view.
On the design surface, click the chart twice to bring up data, series and category field drop zones.
Right-click on a field contained in the series field drop zone and select Series Group Properties.
Click Filters. This displays the current list of filter equations. By default, the list is empty.
Click Add. A new blank filter equation appears.
In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button.
From the drop-down box, select the data type that matches the type of data in the expression you created in step 5.
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.
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).
Click OK.
See Also
Reference
Expression Examples (Report Builder and SSRS)
Concepts
Add Dataset Filters, Data Region Filters, and Group Filters (Report Builder and SSRS)
Gauges (Report Builder and SSRS)