added support for last and Min,Max,Sum,Average where the projection exists first.