The need to sort when using more than one datasource in Tableau is very common for analytical reasons. However, we cannot directly sort on a secondary datasource in Tableau.
What we can do, however, is create a parameter with two options : Profit Ascending and Profit Descending. We then create a calculated field in our secondary data source with this :
SUM(IF [SortingParameter]='Profit Ascending' THEN [Profit] ELSE -[Profit] END)
Now we put it as a Discrete field (right click on it and select Discrete) and as the first field on our rows. Then right click on it and unselect "Show Header". We can now control the sorting with our parameter.