How does one sort a view by more than one dimension/measure in Tableau? The following steps will help you accomplish this :
Consider the following Sales Data
Create Calculated field for Sorting –
- Right Click in Data Pane and select Create Calculated Field
- Type the following formula and type the name as sort_by_dimension and then click OK.
if [Sort By] = ‘Shop Name’ then [shop_name]
elseif [Sort By] = ‘Product’ then [product]
elseif[Sort By] = ‘category’ then [category] end
Implement in View –
- Drag the required dimensions to row – In this case it could be Shop Name, Product, Category.
- Add measures like quantity, sales to column
- Drag sort_by_dimension to Row – placing it at left most
- Right Click on sort_by_dimension and fill in the following values on the dialogue box –
Sort order : Ascending
Sort by : Alphabetic
- Right click on sort_by_dimension and then un-check Show Header
Now, change in values of parameter will change the sorting order.
By Monu Agarwal
Also published on Medium.