Use multiple formulas. One for the sorting and one for the MaxDate.