It seems like you'd want to have the totals stored somewhere ready to use instead of trying to call them on the fly which would be quite slow.