KNOWLEDGE BASE

How to sort the axis label by the alphabet order of the letters instead of numbers


Published: 21 Dec 2022
Last Modified Date: 22 Dec 2022

Question

How to sort/align the axis label by the order of the alphabet characters used instead of numbers.
By default, the numbers are displayed first in sorting before alphabets in axis labels.

 

Environment

  • Tableau Desktop

Answer

Use the "field" sort with this calculated field:
IF ASCII([Name])>57 THEN 1 ELSE 2 END

The ASCII function obtains the ASCII code of the first character. This calculated field uses the fact that the ASCII code for numbers is 57 or less but the alphabet is 65 or higher.  

As shown in the view, the alphabet on the axis label can be displayed before numbers.
User-added image
Did this article resolve the issue?