This is a ranking function with ties. Tied items share the higher rank.
IF ISNULL(SUM([Sales])) THEN
IIF(SUM([Sales]) == LOOKUP(SUM([Sales]), -1), PREVIOUS_VALUE(1), INDEX(), 1)
Inputs and Setup:
An aggregate measure such as "SUM([Measure])", or a calculation producing one.
Partitioning and Addressing:
Direction that SUM([Sales]) is sorted in table, or an "Advanced" field sort on SUM([Sales]).
After a tie occurs and two rows share the same rank, the next row's rank is unaffected - it is the same rank that it would have had if there had been now tie above it. Values of 5, 3, 3, 2 would produce ranks 1, 2, 2, 4.
Adopted from James Baker: http://community.tableau.com/thread/108967