The following example uses AVERAGE to calculate the average year to date sales for all companies in the Company table and displays it in Text control on a form:

select COMPANY

average YTD_SALES to form.ytdSalesText.text