I have a gallery that displays a value from a lookup column and would like to be able to sort on that column. I've read a couple of posts that are similar, but I can't seem to wrap my brain around how to apply this to exactly what I'm doing.
My gallery header has sort icons next to the columns that users can sort on.

When a sort icon is selected, it sets a variable that indicates which column they are sorting on.
My gallery Items property is:
- Filtering on the Project Status = In Progress
- Sorting based on the variable that was set with the above icon was clicked
- And searching based on text entered in a search box:
Filter(
SortByColumns(
Search(
CSProjects,
input_Search.Text,
"Title"
),
varSortBy,
If(
varSortOrder,
Ascending,
Descending
)
),
ProjectStatus.Value = "In Progress"
)
This works fine for the Project Name and Due Date columns. However, the Portfolio column is a lookup to another SharePoint list.
From what I've read, I think I need to somehow use AddColumns but am not sure where to place that in the above code. And I'm not really sure what syntax I need in the AddColumns, something like this (maybe???). Any help or insight is greatly appreciated!
AddColumns(
CSPortfolios, //Name of the Lookup List
"Title" //Name of the column that stores the portfolio name in the CSPortfolios list
Portfolio.Value //The Porfolio field that is in my Gallery
)