Suppose the attribute whose mode you want to compute is a. Define the following formula:
mean( a, rank (a) - uniqueRank (a) = max (rank (a) - uniqueRank (a)))
This formula exploits the difference between rank and uniqueRank with regard to values that occur more than once.