Sort List, but Place Certain Items First?

Is it possible to sort a list of items but have certain values placed first no matter what?

I have a list of surgeons I need to enter into a table to act as options for an enum list, but Unknown and Not Yet Completed are options in the current list. I’d like those two options to be at the top of the list, but the surgeons to be alphabetized beneath these two.

Thanks

Yes, with a caveat. Use List addition operator, for example:

LIST("Item A", "Item B") **+** SORT(<<expression to retrieve list of doctors not including Item A and Item B>>)

NOTE: If your list is supplying a REF type column, Item A and Item B must be items in the referenced table and you would use ORDERBY() instead:

LIST("Item A Row ID", "Item B Row ID") **+** ORDERBY(Doctors[<<Row ID>>],[Doctor Name Column])

ORDERBY function details

3 Likes

Thank you. In your first example, the SORT() option automatically removes the two items added first?

1 Like

That is likely due to how you have constructed the expression inside of the Sort().

it works as prescribed, the first two are as i put them in the LIST() expression, and do not show up a second time in the SORT() part.

Thank you

You can also include multiple sort keys within ORDERBY.

ORDERBY(Doctors[Doctor Code], IN([Doctor Code], LIST("{Unknown ID}", "{Not Yet Completed ID}")), true, [Doctor Name])