get line item quantities and price in condition value formula VOFM
I am trying to create a condition value formula in VOFM which will allow me to sum up all the line item quantities in material group '01' and also the price
item 1 70EA $5 mat group 01
item 2 80EA $10 mat group 01
item 3 100EA $8 mat group 02
in which case I can capture the total qty as 150EA and total price as $15.
I want to then calculate the average (150/15 = 10) and place this into a header condition.
I am not sure how to code this in the condition value formula, please advise