Group Expression Examples (Report Builder and SSRS)
Applies To: SQL Server 2016
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 Add or Delete a Group in a Data Region (Report Builder 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.
The following table provides examples of group expressions that you can use to define a group.
|Group by the |
|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
|Group by three separate age ranges:|
"Under 21", "Between 21 and 50", and "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