Summarizing Values Using Custom Expressions

See Also

In addition to using aggregate functions to summarize data, you can create custom expressions to produce summary values. You can use custom expressions in place of aggregate functions anywhere in an aggregate query.

For example, in the titles table you might want to create a query that shows not just the average price, but what the average price would be if it were discounted.

You cannot include an expression that is based on calculations involving only individual rows in the table; the expression must be based on an aggregate value, because only the summary values are available at the time the expression is calculated.

To specify a custom expression for a summary value

  1. Specify the groups for your query. For details, see Grouping Rows in Query Results.

  2. Move to a blank row of the Grid Pane, and then type the expression in the Columns column.

    The Query Designer automatically assigns a column alias to the expression to create a useful column heading in query output. For more details, see Creating Column Aliases.

  3. In the Group By column for the expression, select Expression.