in Tableau you can only sort using one field.
So, if you want to sort using two, you need to create combined filed (Container weight + Quantity), drop it on the shelf, use it for the quick sort and, to return to the original design, hide it.
I hope it solves your problem,
I am trying to sort independently using weight and quantity.
Tableau likes to sort by the left-most column. In order to let user select sorting by weight or quantity, we recommend to create a Parameter and use a hidden field. In this screenshot, users can select Profit, Sales or Quantity to sort by.
In order to achieve this, you first create a Parameter with the values (headers) that you want to sort by. Right click on the parameter and select "Show Parameter Control" to have it added to the viz.
Next, create a calculated field that will be the values of your measures based on the selected Parameter value:
Next, right click on the Dimension you want to sort by (in my case, Sub-category), and choose to sort by this field.
Add this "Sort By Field" to the viz as the left most discreet measure and you can hide it by unchecking "Show Header".
Workbook attached. Also, you may need to remove any sorts on other columns by selecting "Clear Sort" in the drop down menu. You have sorts (indicated by the ascending or descending 3 lines in the pill) on 4 total pills.
Sort by example.twbx 1.2 MB
If you want to filter on Qty + weight at the same time, you can trick it by using a quick table calculation:
1/ clcik on weight => Quick table calculation => Rank (this wil replace the field by a rank field)
2/ convert this new measure as "discrete" and put it close to your other dimensions
3/ Select again weight from your measure shelf to put it back as a measure field
4/ Click on the sort icon in the tool bar
5/ right clicking on you rank dimension field and unselect "show header".
Voila it should work
Thanks for your inputs..but the requirement here is to display the sort option next to Container Weight field like it's available for Quantity. The Customer wants to be able to do a quick sort depending on these two fields. If they want to see the data sorted by container weight they should be able to click the sort icon and it should sort the whole text table based on container weight and likewise for Quantity.
Do you know if there is a way to include this functionality?
There is no way to override the default quick sort behavior. You can visually float the "Sort By" element so it is directly over the headers, but you cannot use the sort icon in the manner your customer wants.
I'm still not sure if that's what you need but try creating calculated field (let's name it "Sorting Field") which you will use for sorting. Create a parameter "Sort by" with two options: Container weight and Quantity.
Now, the "Sorting Field" should look like
IF [Sort by] = "Quantity" then [Quantity]
ELSE [Container weight] END
Hope it somehow helps,
The customer requirement will not be met unfortunately, it just won't work the way they want it to work