Some dirty tricks to make sum by work with percent by.