Share via

Group Expression Examples (Report Builder 3.0 and SSRS)

In a data region, you can group data by a single field, or create more complex expressions that identify the data on which to group. Complex expressions include references to multiple fields or parameters, conditional statements, or custom code. When you define a group for a data region, you add these expressions to the Group properties. For more information, see How to: Add or Delete a Group in a Data Region (Report Builder 3.0 and SSRS).

To merge two or more groups that are based on simple field expressions, add each field to the group expressions list in the group definition.


You can create and modify report definitions (.rdl) in Report Builder 3.0 and in Report Designer in Business Intelligence Development Studio. 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 3.0 (SSRS) on the Web at

Examples of Group Expressions

The following table provides examples of group expressions that you can use to define a group.



Group by the Region field.


Group by last name and first name.



Group by the first letter of the last name.


Group by parameter, based on user selection.

In this example, the parameter GroupBy must be based on an available values list that provides a valid choice to group on.


Group by three separate age ranges:

"Under 21", "Between 21 and 50", and "Over 50".

=IIF(First(Fields!Age.Value)<21,"Under 21",(IIF(First(Fields!Age.Value)>=21 AND First(Fields!Age.Value)<=50,"Between 21 and 50","Over 50")))

Group by many age ranges. This example shows custom code, written in Visual Basic .NET, that returns a string for the following ranges:

25 or Under

26 to 50

51 to 75

Over 75


Custom code:

Function GetRangeValueByAge(ByVal age As Integer) As String

Select Case age

Case 0 To 25

GetRangeValueByByAge = "25 or Under"

Case 26 To 50

GetRangeValueByByAge = "26 to 50"

Case 51 to 75

GetRangeValueByByAge = "51 to 75"

Case Else

GetRangeValueByByAge = "Over 75"

End Select

Return GetRangeValueByByAge

End Function