Creating a custom sort order for a column

What is the best way sort worksheet data based on a custom ordering of values in a given column, rather than ascending or descending.
For example, if my column has values ‘Apples’, ‘Cherries’, ‘Grapes’, and ‘Melons’, and I want to sort my data so ‘Cherries’ is at the top of the worksheet table, then ‘Melons’, ‘Apples’, ‘Grapes’, how can I do this?

1 Like

There are two ways that I can think of to do this.

  1. Create a new column where the formula is something like this
    If([Fruits] = "Cherries", 1, If([Fruits] = "Melons", 2, If([Fruits] = "Apples", 3, If([Fruits] = "Grapes", 4, 5)
    Then Sort on this new column.

  2. Another option would be to create a lookup table by doing CSV upload where you create 2 columns 1 with the value of the data. The other column with a number based on the order that you want. i.e

    Cherries      1
    Melons        2
    Apples        3
    Grapes        4 

Now do a join on this table. Then sort on the new column that was added.

Eventually we’ll make the 2nd step easier where you wouldn’t need to upload a CSV and you’ll be able to create a table within Sigma for lookups.