Analytics tricks — Sorting by dimension using parameters using Tableau

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

shop_name category product price Reliance Food OAT 100 Reliance Digital Electronics Laptop 25000 Croma Electronics Speaker 700 Reliance House Hold Mob 150


Create Parameter-

  1. Right Click in Data Pane and select Create Parameter
  2. Dialogue Box will appear. Select the following and then click OK
  • Name : Sort By
  • Data Type : String
  • Allowable Values : List
  • In the list enter : Shop Name, Product, Category
  1. Right Click on the parameter create and select “Show Parameter Control”

Create Calculated field for Sorting -

  1. Right Click in Data Pane and select Create Calculated Field
  2. 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 -

  1. Drag the required dimensions to row — In this case it could be Shop Name, Product, Category.
  2. Add measures like quantity, sales to column
  3. Drag sort_by_dimension to Row — placing it at left most
  4. Right Click on sort_by_dimension and fill in the following values on the dialogue box -
  5. Sort order : Ascending
  6. Sort by : Alphabetic
  7. 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
 Coviam Technologies

Originally published at .

Like what you read? Give Coviam Technologies a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.