The AVG. column function calculates the average of all values in a column for rows selected. It applies to numeric data and returns a single value for that data. You can use the UNQ. operator with AVG. to use only unique values when calculating the average. A column function does not include null values in its calculation.
To select only the SALARY column, define an example element for SALARY in the SALARY column. Then, add an unnamed column, request the average, and put the example element in the unnamed column.
When you run this query:
Q.STAFF | SALARY | | --------+--------+---------| | _S |P.AVG._S | |
QMF produces this report:
AVG(SALARY) ------------------ 16675.6422857142
To find the average of the values in the SALARY column for clerks only, add a condition to your query:
When you run this query:
Q.STAFF | SALARY | JOB | | --------+--------+-------+----------| | _S | CLERK | P.AVG._S | |
QMF produces this report:
AVG(SALARY) ------------------ 12612.6125000000