Gurus of GoogleSheets/ImportXML/XPath coding,
Quick question... two ImportXML statements with the only difference being the XPath Aggregate function: sum works, avg doesn't.
=ImportXML("http://api.eve-marketdata.com/api/item_orders2.xml?char_name=Demo&buysell=b&type_ids=17464&station_ids=60003760","sum(/emd/result/rowset/row[not(preceding-sibling::row/@price > @price or following-sibling::row/@price > @price)]/@volremaining)")
=ImportXML("http://api.eve-marketdata.com/api/item_orders2.xml?char_name=Demo&buysell=b&type_ids=17464&station_ids=60003760","avg(/emd/result/rowset/row[not(preceding-sibling::row/@price > @price or following-sibling::row/@price > @price)]/@volremaining)")
NOTE: For the page in the formula, there goal is to find the row with the highest @price... then get the quantity/volremaining and price. However, when there are multiple rows at the highest price, I need to sum(@volremaining) and avg(@price) since I only want one row returned. I can use the [1] offset to get this value...
=ImportXML("http://api.eve-marketdata.com/api/item_orders2.xml?char_name=Demo&buysell=b&type_ids=17464&station_ids=60003760","/emd/result/rowset/row[not(preceding-sibling::row/@price > @price or following-sibling::row/@price > @price)][1]/@volremaining")
... but the exercise to get min()/max()/avg() to work is failing.
Can't for the life of me figure out the difference, other than the W3C XPath Site shows fn:avg with double brackets ((arg1,arg2,arg3)), while fn:sum is single brackets (arg1,arg2,arg3).
Your assistance will be greatly appreciated.
Regards,
G A