Too many charts on your dashboard? Comparing the same metric to a series of others over and over?
Where there’s a will, there’s a way!
Presenting…
Using Parameters to Switch Metrics!
Example Scenario:
We want to show Sales by Sub-Category, Quantity by Sub-Category, and Profit by Sub-Category. Notice that all of these charts have the common field of Sub-Category, and we want to compare that field to Sales, Quantity, and Profit.
Sales by Sub-Category
Quantity Sold by Sub-Category
Profit by Sub-Category
I will just pull these into the dashboard so we can see what we are working with.
While we have not yet put any style or padding onto this dashboard, it already feels crowded!
Let’s now use parameters to put all of them into a single view, and the user can then choose which one they want to see!
HOW TO:
1) Pick a chart, any chart that contains one of the fields that you plan to use! I will choose the Quantity by Sub-Category chart.
2) In your data pane, select the ▼ arrow to show more options and then select ‘Create Parameter…’
Name your parameter accordingly. It’s best to not be lazy here because when you want to find this single parameter amongst several, it is helpful to know exactly what you are looking for. Next, we know that we want to choose whether we have Sales in the view, or Quantity, or Profit. All of those values are strings, so be sure to select the correct data type and then we can fill in the options for our user to toggle between. For the purpose of what we are aiming to do, select ‘List’ from the ‘Allowable values’ options. Now, some Data Analysts will choose to have their own naming conventions in this next step, but for those of us that prefer obvious and specific names, let’s make sure the Value and Display As fields are identical. (Note: The value is what you will use in the next step when we create a calculated field, and the Display As are the options that will be presented to the user when they are in the dashboard view.) We want our user to be able to select between Sales, Quantity, and Profit and show the chosen breakdown by Sub-Category.
Now head back to that same menu to ‘Create a Calculated Field’. In this step we are creating a communication between the graph and the parameter (where the user will be able to toggle the views).
In the calculated field, as a best practice, title appropriately. I will call my calculated field “Chart Type in View” since it will determine which chart type is in the view. We will use the CASE formula with our [Chart Type Parameter] so that we can match the Values from our Chart Type Parameter with the metric that we want to show. The Values are the gray text in quotes and the metrics are the orange text in square brackets. Don’t forget to finish up your calculation with an END and press OK.
Now, we drag your new calculated field to the columns shelf. Sort in descending order.
Then, right click your parameter and select ‘Show Parameter’ to add it to the view.
Your parameter will show up in the pane on the right of the Tableau view. You can now toggle between these options and your chart will adjust accordingly!
Now, let’s tidy these titles up a bit - both the axis title and the title of the chart. We want that when we select a particular metric from the Chart Type Parameter, that the axis and the chart title also reflect those changes.
Chart Title: Double-click on the Chart Title to edit it. Then, delete . Select the Insert option in the top right of this window, and select Parameters.Chart Type Parameter.
After that text, finish up the title by writing in ‘by Sub-Category’. Format to your desires.
Axis Title: Right click on the x-axis and select ‘Edit Axis’.
Find the section where you can edit the Axis Title and select ‘Custom’. From that drop down, select Chart Type Parameter. Now, close this window by selecting the X in the top right.
Now go ahead and select the metric that you would like to analyze and watch those charts change! When you bring this chart onto your dashboard remember to bring that parameter along. Now, you and your users have access to all three charts but within the same space, thus leaving a lot more real estate for all of your other relevant analysis! Yay!
Connect with me on LinkedIn!