Usually when I have something like this, I make a variable that can be set to the appropriate value (based on the selected criteria) and sort by that variable. Something like SortVal = CASE WHEN SelSort = ‘Customer ID’ then CustID WHEN SelSort = ‘Customer Group’ then Customer Group etc. Then sort on SortVal.

