I think it should clearly be total dollars spent divided by total miles flown.
I have another question, though: if I fly on a 016 ticket, and in fact all UA flight numbers, SFO-FRA on UA metal, FRA-DXB-FRA on LH metal, FRA-SFO on UA metal, how many dollars and miles do I count towards total and average UA spend calculations?