Avg

The Avg function returns the average (arithmetic mean) of values in a number column.

Avg (numbers, break_col, break_value)

where:

numbers references the column that contains the numbers on which the average is calculated.

break_col is an optional parameter that references a break column.

break_value is an optional parameter that returns the average of numbers column where value in break_col equals break_value.

Note:

If constant values in the break_value column are substituted for data items, dates and text strings must be enclosed in single quotes.

The following examples show the results of inserting the Avg function in three separate tables.

Example 1

In this example, the Avg function is used on the numeric column. The results are shown in the Computed column.

Avg (Amount)

Table 144. Avg Example 1

State

City

Amount

Computed

AZ

Tucson

112

183.67

CA

Burbank

240

183.67

CA

Glendale

97

183.67

FL

Palmetto

70

183.67

MD

Laurel

97

183.67

MI

Detroit

208

183.67

MN

Eagan

159

183.67

NY

New York

490

183.67

NY

Rochester

180

183.67

Example 2

In this example, the Avg function is used on the numeric column and break_column. The results are shown in the Computed column.

Avg (Amount, State)

Table 145. Avg Example 2

State

City

Amount

Computed

AZ

Tucson

112

112

CA

Burbank

240

168.5

CA

Glendale

97

168.5

FL

Palmetto

70

70

MD

Laurel

97

97

MI

Detroit

208

208

MN

Eagan

159

159

NY

New York

490

335

NY

Rochester

180

335