Skip to main content

Create a Totals Query

When a query is created, by default, it is a detail query (each record is displayed in the output). The query may be modified to become a totals query (only summarized records are displayed).

  1. In the Field List grid, right-click the columns header, and select Toggle Totals. The Total column appears in the Field List grid, displaying the default value Group By, for each field, excluding calculated fields.
  2. For each field in the list, click the drop-down list, and select the appropriate Total value, based on the planned output for the query. See the following table for more information:
  3. Totals Value

    Description

    Group By

    Displays each distinct value once, per break point.

    Sum

    Sums the field for each record, at the break point.

    Avg

    Averages the field, at each break point.

    Min

    Displays the minimum value for the field, at each break point.

    Max

    Displays the maximum value for the field, at each break point.

    Count

    Counts the records for the field, at each break point.

    StDev

    Displays the standard deviation of the field, at each break point.

    Var

    Displays the variance of the field, at each break point.

    First

    Displays the first value of the field.

    Last

    Displays the last value of the field.

    Expression

    Does not assign a Group By value, but is used for calculated fields, where the Group By value has already been assigned in the definition of the field.

    Where

    • For visible fields, use when criteria will be applied to the grouped field. This is expressed in the SQL code as a HAVING statement.
    • For fields that are not visible, use when criteria will be applied at a detail record level. This is expressed in the SQL code as a WHERE statement.

    Detail Output vs. Totals Output

    The following examples show the comparison of outputs for detailed and totaled queries:

    Example: Detail Output (Each Output Record Visible)

    Example: Totals Output (One Output Record per Employee)

Was this article helpful?

We're sorry to hear that.

Powered by Zendesk