Skip To Content

Adding mileage fields using a calculated field

You can calculate mileages based on cross-table calculations of multiple event layers to produce a mileage report. As shown in the sample report below that demonstrates the lane miles by urban type, the mileages are calculated by using two separate event layers: Urban Type and Number Travel Lanes.

Mileage report showing lane miles by urban type
A few other uses of cross-table mileage calculations can be reports that show mileages for Vehicle Miles Traveled (VMT) for Rural Roads, Lane miles by Functional Class, Lane miles by Pavement Type, and so on.

In this example, a mileage report similar to the one shown above that uses cross table calculations of multiple event layers is produced. The mileages and summaries are calculated using internal event layers that are part of the LRS.

Data required

The following data layers are used to create the report. The layer names used here are for information only. You can use your own layer names to produce your reports:

Data layers used to create the mileage report

LRS data typeLayer nameExplanation

LRS Network layer


The routes are selected from this layer. The mileage is calculated on the selected routes.

Internal linear event layer


This is the summary layer used to calculate countywise mileage of the routes.

Internal linear event layer

Urban Type

The mileages are calculated using this layer.

Internal linear event layer

Number Travel Lanes

The lane miles information is provided by this layer.

  1. Configure a mileage report.
  2. Select the routes.
  3. Select the summary fields.

    In this example, the County event is used as the summary event.

  4. 单击下一步
  5. Click Add Field(s).
    Click the Add Field(s) button

    The Mileage Fields - Add Field(s) pane appears to the right.

    Adding the unique values using the Urban Type layer
    Adding the unique values using the Urban Type layer

  6. Choose an event From the Mileage Layer drop-down list.

    The internal linear events appear in this list. In this example, Urban Type is chosen.

  7. Click Unique Values.
  8. From the Field drop-down list, choose a unique value for the event.

    • This drop-down list shows the fields available in the Urban Type event. In this example, the URBANTYPE field is chosen.
    • The Add Formula and Add Field tools are applied to all the checked fields.

    1. To add an extra mileage field that is not part of the unique values, for example, by using the Speed_Limit field from the Speed Limit event, click OK and then follow the steps as described in the Add mileage fields section of Configuring a mileage report.
    2. Check the check boxes in the Field Name list to filter the unwanted fields from the report.

      For this report, the Large Urban Cluster and Small Urban Cluster fields have been removed.

  9. Click Add Formula.

    In this example, the lane miles for each urban type are calculated using a formula.

    The Mileage Fields - Formula pane opens.

    Using a formula for cross-tabulation of events
    Using a formula for cross-tabulation of events

  10. In the Formula text box, add a formula similar to !UrbanType.LENGTH!*!NumberTravelLanes.NUMBEROFTRAVELLANES!.

    To add the formula using the UI, click Length in the Fields list, click the multiplication button, choose the Number Travel Lanes event in the Filter by drop-down list, and click NUMBEROFTRAVELLANES from the Fields list.

    Use the following to calculate lane mileage in this formula:

    • !Lane Mileage! = (!Length!*(!NUMBEROFTRAVELLANES!)) ), where !LENGTH! = (!to_measure!-!from_measure!)
    • For each element in the formula, the event's name precedes the field name. Therefore, the element !UrbanType.LENGTH! means that the length field comes from the Urban Type event.
    • The variable !NUMBEROFTRAVELLANES! comes from the values present in the attribute field of the selected mileage layer.
    • Only numerical fields are listed in the Fields list.

    This formula will be applied to calculate mileage for all the checked fields from the previous step.

  11. Click OK.

    The added fields now act individually and you can edit them one by one using the edit tool.

    The mileage fields with chosen urban types appear in the Field Name list.

    Mileage fields added

  12. Click Next.

    The Report Fields pane appears.

    Report Fields

Use the report formatting tools as shown in Formatting a report and then run the report as shown in Running a report to produce a report using cross-table calculation of multiple event layers.

  1. Data required