You are facing this problem because of data type of your list columns. SortByColumns function will work fine with "Single line of text", "Number" or "Date and Time" columns simply by referring column names in formula.

But, sort on complex fields like "Choice" or "Person or Group" column will not work this way.

You have to get the value/property from these complex field based on which you will sort your gallery.

**Example**:

**SharePoint list data**:

[![enter image description here][1]][1]

To filter gallery based on Choice (Status) column, Person or Group (PersonCol) I have used formula like this:

```
SortByColumns(
    AddColumns(ReCreate, "StatusValue", Status.Value, "PersonColValue", PersonCol.DisplayName),
    If(
        Dropdown1.Selected.Value = "Title",
        "Title",
        Dropdown1.Selected.Value = "Modified",
        "Modified",
        Dropdown1.Selected.Value = "Status",
        "StatusValue",
        Dropdown1.Selected.Value = "Person Column",
        "PersonColValue",
        "ID"
    ),
    Ascending
)
```

Here I am filtering gallery items based on display name of Person or Group column.

**Output**:

[![enter image description here][2]][2]

<hr>

Similarly, you have to adjust your formula based on data types you are using.

**Documentations**:

1. [AddColumns, DropColumns, RenameColumns, and ShowColumns functions in Power Apps](https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-table-shaping)
2. [Sort and SortByColumns functions in Power Apps](https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-sort)


  [1]: https://i.sstatic.net/RHgXb.png
  [2]: https://i.sstatic.net/az4NJ.png