Click to Rate and Give Feedback
TechNet
TechNet Library
SQL Server
SQL Server 2008
Reporting Services
Development
Tutorials
 Lesson 6: Adding Grouping and Total...
Other versions are also available for the following:
SQL Server 2008 Books Online (August 2008)
Lesson 6: Adding Grouping and Totals (Reporting Services)

Add grouping and totals to your report to organize and summarize your data.

  1. Click the Design tab.

  2. From the Report Data pane, drag the Date field to the Row Groups pane. Place it above the row called Details.

    Note that the row handle now has a bracket in it, to show a group. The table now also has two Date columns -- one on either side of a vertical dotted line.

    ms170712.996e1cf1-35ff-4f32-a333-1712944f8812(en-us,SQL.100).gif
  3. From the Report Data pane, drag the Order field to the Row Groups pane. Place it below Date and above Details.

    Note that the row handle now has two brackets in it, to show two groups. The table now has two Order columns, too.

  4. Delete the original Date and Order columns to the right of the double line. This removes this individual record values so that only the group value is displayed. Select the column handles for the two columns, right-click and click Delete Columns.

    Select columns to delete

    You can format the column headers and date again.

  5. Switch to the Preview tab to preview the report. It should look similar to the following illustration:

    Table grouped by date and then order
  1. Click the Design tab.

  2. From the Report Data pane, drag the Date field to the Row Groups pane. Place it above the row called Details.

    Note that the row handle now has a bracket in it, to show a group. The table now also has two Date columns -- one on either side of a vertical dotted line.

    ms170712.996e1cf1-35ff-4f32-a333-1712944f8812(en-us,SQL.100).gif
  3. From the Report Data pane, drag the Order field to the Row Groups pane. Place it below Date and above Details.

    Note that the row handle now has two brackets in it, to show two groups. The table now has two Order columns, too.

  4. Delete the original Date and Order columns to the right of the double line. This removes this individual record values so that only the group value is displayed. Select the column handles for the two columns, right-click and click Delete Columns.

    Select columns to delete

    You can format the column headers and date again.

  5. Switch to the Preview tab to preview the report. It should look similar to the following illustration:

    Table grouped by date and then order
  1. Switch to Design view.

  2. Right-click the data region cell that contains the field [LineTotal], and click Add Total.

    This adds a row with a sum of the dollar amount for each order.

  3. Right-click the cell that contains the field [Qty], and click Add Total.

    This adds a sum of the quantity for each order to the totals row.

  4. In the empty cell to the left of Sum[Qty], type the label "Order Total".

  5. You can add a background color to the totals row. Select the two sum cells and the label cell.

  6. On the Format menu, click Background Color and click Light Gray.

    Design view: Basic table with order total
  1. Switch to Design view.

  2. Right-click the data region cell that contains the field [LineTotal], and click Add Total.

    This adds a row with a sum of the dollar amount for each order.

  3. Right-click the cell that contains the field [Qty], and click Add Total.

    This adds a sum of the quantity for each order to the totals row.

  4. In the empty cell to the left of Sum[Qty], type the label "Order Total".

  5. You can add a background color to the totals row. Select the two sum cells and the label cell.

  6. On the Format menu, click Background Color and click Light Gray.

    Design view: Basic table with order total
  1. Right-click the Order cell, point to Add Total, and click After.

    This adds a new row containing sums of the quantity and dollar amount for each day, and the label "Total" in the Order column.

  2. Type the word Daily before the word Total in the same cell, so it reads Daily Total.

  3. Select the Daily Total cell, the two Sum cells and the empty cell between them.

  4. On the Format menu, click Background Color and click Orange.

    ms170712.55a3b514-1c70-4aec-a6c8-f2a9d6435265(en-us,SQL.100).gif
  1. Right-click the Order cell, point to Add Total, and click After.

    This adds a new row containing sums of the quantity and dollar amount for each day, and the label "Total" in the Order column.

  2. Type the word Daily before the word Total in the same cell, so it reads Daily Total.

  3. Select the Daily Total cell, the two Sum cells and the empty cell between them.

  4. On the Format menu, click Background Color and click Orange.

    ms170712.55a3b514-1c70-4aec-a6c8-f2a9d6435265(en-us,SQL.100).gif
  1. Right-click the Date cell, point to Add Total, and click After.

    This adds a new row containing sums of the quantity and dollar amount for the entire report, and the Total label in the Date column.

  2. Type the word Grand before the word Total in the same cell, so it reads Grand Total.

  3. Select the Grand Total cell, the two Sum cells and the empty cells between them.

  4. On the Format menu, click Background Color and click Light Blue.

    Design view: Grand total in basic table
  5. Click Preview.

    The last page should look something like this:

    Preview: Basic table with grand total
  1. Right-click the Date cell, point to Add Total, and click After.

    This adds a new row containing sums of the quantity and dollar amount for the entire report, and the Total label in the Date column.

  2. Type the word Grand before the word Total in the same cell, so it reads Grand Total.

  3. Select the Grand Total cell, the two Sum cells and the empty cells between them.

  4. On the Format menu, click Background Color and click Light Blue.

    Design view: Grand total in basic table
  5. Click Preview.

    The last page should look something like this:

    Preview: Basic table with grand total

You have successfully completed the Creating a Basic Table Report tutorial. You can use this basic table report as a basis for these other tutorials. See:

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker