Microsoft Visio 2010 : Working with Data - Creating Reports (part 2) - Grouping and Totaling Items in a Report
2. Grouping and Totaling Items in a Report
You’ve just created a nice inventory of the light bulb shapes in your drawing and their associated data, but the report would be more informative if it grouped like items and showed totals. It would also be nice to make it portable, so that you can use it in other drawings.
Grouping Items in Reports
1. | Continue working with Ch7 Shape Data.vsd. |
2. | Right-click the report shape that you created on the Basic Report page, and choose Update Report. |
3. | Select Light Bulb Power Use from the list and then click Modify. |
4. | Click Next twice until you see the Subtotals button and then click it. The Subtotals screen appears. |
5. | Choose Group By: Bulb Type so that like bulb types are listed together in the report. |
6. | Click
OK, then Next, Finish, and Run to run the modified report. The report
now has all bulbs grouped together by type, sorted alphabetically. |
7. | Save the drawing. |
Adding Subtotals to Reports
1. | Continue working with the Ch7 Shape Data.vsd drawing, and the report shape on the Basic Reports page. |
2. | Return to the Subtotals screen, as you did in steps 2, 3, and 4 of the previous exercise. |
3. | In the Subtotals list, check COUNT in the Bulb Type row, and check COUNT and TOTAL in the Power row, as shown in Figure 3.
Figure 3. Reports can be ordered using grouping, as well as subtotals. |
4. | Click
OK, then Next, Finish, and Run to run the modified report. You now see
counts and totals, in addition to items grouped together. Figure 3 shows this version of the reporting shape on the right. |
5. | Right-click the report shape and return to the Subtotals screen, as you’ve done before. |
6. | Click Options. The Options dialog appears. |
7. | Check Don’t Repeat Identical Values. |
8. | Check Exclude Duplicate Rows in Group. |
9. | Check Show Grand Totals. |
10. | Click OK, then OK, Next, Finish and Run to execute the modified report. Figure 4 shows an example. Notice the Quantity column that enables duplicate items to be tallied in single rows.Figure 4. The report modified to show grand totals and not display duplicate values. Note the Quantity column appears to make up for suppressed duplicate values. |
11. | Save the drawing. |
Storing a Report Definition in a Report Shape
1. | Continue working with the Ch7 Shape Data.vsd drawing and the report shape on the Basic Reports page. |
2. | Right-click the report shape and choose Update Report. |
3. | Under Save Report With, check Copy of Report Definition this time. |
4. | Click Run to rerun the report. The report looks identical to the last time you ran it. |
5. | Right-click
the report shape and choose Update Report again. In the Update Report
screen, notice the new entry in the list: “Definition Stored in Shape.”
This is a result of the change you made in step 2. |
6. | Save the drawing. |
So far you’ve made heavy use of the options behind the Subtotal button. On the same screen as Subtotal, you also find the Sort and Format buttons. If you need to control the number of decimal places shown in a report, click the Format button. Behind the Sort button, you find more sorting options that you might want to investigate.