Add base class for data query max/min/avg/sum functions

This solves a possible ambiguous field error