Forum Discussion

Giada90's avatar
Giada90
Icon for Helper IV rankHelper IV
1 year ago
Solved

custom order of a string

Hi, is it possible to have a custom order for a string? for example something like this   banana strawberry apple melon   which formula can I use? thanks
  • mdaatifraza5556's avatar
    1 year ago

    Hi Giada90 

    You can try this

    SortOrder =
    SWITCH(
    'YourTable'[Fruit],
    "banana", 1,
    "strawberry", 2,
    "apple", 3,
    "melon", 4,
    999 // default if not found
    )


    If this answers your questions, kindly accept it as a solution and give kudos.