Average order value
Example
A manager asks for the average order value of the paid March orders. A colleague averages quantity * unit_price over the 11 lines. The five orders hold those 11 lines and total 180 in revenue.
Predict before the next step
Will the colleague’s number be larger than, smaller than or equal to the real average order value?
Your writing stays on this page only. It is not saved or assessed.
Walkthrough
AVG averages the rows it is given, and these rows are lines. 180 divided by 11 lines is 16.36: the average worth of one product on an order. An order is worth all its lines together, so the order totals have to exist as rows before they can be averaged.
Step 1: group the lines by order. The five order totals are 54, 32, 40, 20 and 34, which add to 180. Step 2: average those five rows. 180 divided by 5 is 36.
The data and the revenue did not change, only the rows the average ran over. Whenever you average, name the thing being averaged (“per order”), build a table with one row per such thing, and average that.