Sometimes we may want to use one chart to show more insights or add interactivity. You can deal with this issue by creating parameters. I will use the sample superstore dataset to show how to utilize parameters to control different fields’ sort, display, and Top N. You can find the dataset on the first page of Tableau.

 

Step 1: Create a parameter and add all fields you want to explore

You can set any value you want, but it would be better if you filled in the correct name.

Figure 1. Chosen fields parameter configuration

 

Step 2: Create a calculated field and write the statement

Cause the total quantity, total sales, and average profit are the aggregated fields, we should add aggregation to the fields.

Figure 2. Chosen fields statement

 

Step 3: Create the Chart with the parameter

Firstly, put <State/Province> on the row’s shelf and move <Pick Measure> and <Chosen Measure> to the column’s shelf.

Secondly, Right-click <Pick Measure> and pick <Show parameter>.

Thirdly, Click the top-right drop-down button of the parameter and select Single Value (list).

Then you can switch different values in the parameter list to view their corresponding insights.

Figure 3. Chosen fields chart

 

Step 4: Add parameters to control the sorting

Firstly, duplicate the <Pick Measure> parameter and rename it as <Pick Sort>.

After that, create a parameter to control the ascending and descending.

Figure 4. Sorting parameter configuration

 

Figure 5. Ascending/Descending parameter configuration

 

Step 5: Create a calculated field for sorting

Figure 6. Sorting statement

 

Step 6: Set the sorting

Initially, right-click the <State/Province> field on the row’s shelf and select <sort>.

Additionally, sort by Field and set Field Name as <Chosen sort>.

Figure 7. Sort the chart

 

Step 7: Add a parameter to show Top N

Firstly, right-click the <State/Province> field on the row’s shelf and select <Filter…>.

Then select <Create a New Parameter…>.

Eventually, edit the parameter and choose any values you want for the Top N.

Figure 8. The place where you create the Top N parameter

 

Figure 9. Top N parameter configuration

 

Step 8: Go back to the page of filter and fill out the form like the below screenshot

Figure 10. Set the Top N parameter

 

Step 9: Show all parameters and start your exploration!

Figure 11. Final chart

 

 

If there are any problems, please feel free to point them out. Besides, you can reach out to me on LinkedIn. I will try my best to answer your questions about Tableau or Alteryx.

 

Joe Chan
Author: Joe Chan

Joe has an IT background with a master's degree in UNSW, majoring in AI and Data Science. During his studies, he realized Data is one of the most valuable assets a business can have and potentially has a tremendous impact on its long-term success. After graduation, his desire to level up his data analytics skills led him to join The Data School. He is interested in Data Wrangling, Data Visualization, and Machine Learning, eager to be a great Data Analyst to help businesses grow.