@jrothame
So typically, if you want to have sorting by different columns, then you need to "snapshot" the name of the column you want. This is done with a variable.
So, for example, if you wanted to sort by Category and also by SubCategory, then on the Category label (I'd suggest, or some other indicative icon) you would have the following formula:
For Category OnSelect:
UpdateConext({lclSortColumn:"CategoryText"})
and for the SubCatgegory OnSelect:
UpdateConext({lclSortColumn:"SubCategory"})
Now, for your Gallery, change the Items formula to the following:
SortByColumns(
Filter(
AddColumns('Client Solutions',
"CategoryText", 'Solution:Category'.Value),
'Client:ID'.Id = selectedId
),
lclSortColumn,
Ascending
)
Note, if you need to AddColumns in order to get the SubCategory in the same way, then do so, but change the UpdateContext on the SubCategory to match the added column name.
If you want to implement a click for ascending and click for descending, then add the following to your OnSelects:
UpdateContext({lclSortOrder: If(lclSortColumn="Category", !lclSortOrder, true)});
UpdateContext({lclSortColumn:"Category"})
Repeat for the SubCategory, but change the values for it.
Then finally your formula for Items would be the following:
SortByColumns(
Filter(
AddColumns('Client Solutions',
"CategoryText", 'Solution:Category'.Value),
'Client:ID'.Id = selectedId
),
lclSortColumn,
If(lclSortOrder, Ascending, Descending)
)
That should give you what you want. Please observe the pattern here and just implement that for any other columns you need to sort by.