Groups

Grouping organizes the rows of your data into sets that share a common value, so that a report presents structured, summarized information instead of one long flat list. A group is defined by a group expression: every row for which the expression returns the same value belongs to the same group. For example, grouping a Table bound to the Products dataset on the expression:

{Room}

collects the products of each Room together, in a report that runs Room by Room.

Once data is grouped you can, per group:

Grouping in each Data Region

Depending on the data region you are working with, you can group data in the following ways:

Group Expressions

A group is usually defined on a single field, such as {Room}, but any expression can be used — for example, grouping on {Year(Date)} groups rows by year. A group can also have multiple expressions, in which case rows belong to the same group only when all the expression values match.

Nested groups: data regions can contain more than one group, nested parent-and-child — for example, group by System within Room: the Room group is the parent, the System group its child, and each Room heading is followed by a heading and subtotal for each System within it. Each group has a name, unique within the report (a default such as Table1_Group1 is assigned when you create it), which identifies the group when defining aggregates and sort scopes.

Groups and Aggregates

Where you place an aggregate expression determines its scope — which rows it summarizes:

Aggregate placed in... Summarizes...
a detail row the current record (or the current detail group, when detail grouping is applied)
a group header or footer row all the rows of the current group — a per-group subtotal
the table header or footer all the rows of the dataset — a grand total

So the same expression, {Sum([Cost Price])}, gives a subtotal per Room when placed in the Room group footer and a Project-wide total when placed in the table footer. See Common Functions for the available aggregate functions.

Group Properties

Each group has properties which you can set by selecting the group in the Report Explorer, or via the data region's Edit Group context-menu command; its properties then appear in the Properties panel. (Tablix row and column groups are edited in the dedicated Group Editor panel — see Tablix.) The properties are:

Property Description
Group on The group expression(s) described above.
Sorting The order in which the groups appear — usually the group expression itself, for alphabetical order, but any expression can be used; for example, sort the Room groups by {Sum([Cost Price])} to list the most expensive Rooms first. See also Filter, Sort, and Interactive Sort.
Filters Limit which groups appear in the report — see Filters.
Layout Page-break behavior around each group, and whether to repeat the group header/footer on every page — see Manage Page Breaks in Data Regions and Keep Groups Together in Data Regions.
Visibility Hide the group's detail and toggle it from another item, to create an expandable/collapsible report — see Drill-Down Links.

Detail Grouping in List and Table Data Regions

Detail grouping is available in the List and Table data regions. It is useful when you do not want to repeat values within the details. For example, in a Table bound to the Products dataset, without detail grouping you will see as many rows as there are results in the dataset i.e. a row for each Product in the project.

Table with Product Details at run time

Preview of a table without detail grouping

 

If you set detail grouping to:

{[Model Number]}

each Model Number appears once.

In this example the detail grouping uses two expressions — {Manufacturer} then {[Model Number]} — so products are grouped first by Manufacturer, then by Model Number.

Table with added detail grouping at preview

Table with detail grouping applied

When detail grouping has been applied you can then use powerful aggregate functions like Count(), Sum() etc. for example, to show the quantity of each product, or the Sum of the price of all products with the same Model Number.