### Extending prices and subtotaling the extensions

In an orders report or invoice, you may need to extend the prices for individual line items and then subtotal the extensions. You do this by using a simple formula to extend the prices, and then you subtotal the formula field.

###### To extend the price and subtotal the extensions

1. Create a report using the sample data, Xtreme.mdb, and place the following fields from left to right in the Details section:

    {orders.CUSTOMER ID}
    {orders detail.PRODUCT ID}
    {orders detail.QUANTITY}
    {orders detail.UNIT PRICE}

1. To create the formula for extending the prices, choose Insert from the main menu and select Formula Field.

   The Field Explorer dialog box appears.

2. Double click Formula Fields.

   The Formula Name dialog box appears.

3. Enter the name you want to identify the formula.
4. Click OK.

   The Formula Editor appears.

5. Enter the following formula into the Formula text box:

    {Orders_Detail.Quantity} *
    {orders detail.Unit Price}

1. Click the `Save and Close` button when finished.

   You return to the Field Explorer dialog box with the name of your formula listed in the Formula Fields directory.

2. Double-click your formula and place the formula field to the right of the Unit Price field in the Details section of the report.
3. Click Close to close the Field Explorer dialog box.
4. To subtotal extensions, right-click the formula field and choose Insert Subtotal from the shortcut menu.

   The Insert Subtotal dialog box appears.

5. To create a subtotal for weekly sales, select {orders.ORDER DATE} as the sort-and-group-by field, and choose for each week as the group interval.

   Note: The section will be printed drop-down box will not be activated until you choose the Order Date field.

6. Click OK to insert the subtotal in the report.

Your data will be sorted by date and grouped in one week intervals. Your final report should look similar to the following:

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com