Actions are one of the most used functionality in dashboard and story-telling when it comes to tableau Analysis. Actions help in creating dashboards that can be interactive, like changing what you would like to see and not see, hovering over something to see more details of the same, and so on. In all these scenarios the common part is that the user is doing some "Action" and the dashboard is changing accordingly. Let us look into more details.
By the end of this article, you would be able to understand how basic parameter actions can be implemented in tableau
The example used in this article uses Tableau parameters. You will need to have a basic knowledge of what these are and how you use them. Also, we will be using the Sample Super Store data.
Parameter Actions are actions that are executed as a result of making a parameter selection by the user.
Let us first create a viz which displays Sales by Category and Subcategory. This is how it looks like:
Now if I would only like to show the expanded sub-category levels only for one of the user-selected category, I could go ahead and do that by creating a simple parameter on Category and a table calculation to return sub-category level sales for that specific category. Here is screen shots of the same setups.
After that replace the "Subcategory" capsule in the current view with the newly created "SubcategoryDrilldown" in the rows bar. Now the view will look like this.
So, now imagine that this visualization is part of a big dashboard, where you have seperated all the controls to one corner, the user will need to go check that, change and it and then see it reflected here. This could in some scenarios be feeling clumpsy, especially with busy dashboards. What if we could find a way where the user selects a category from the view and just that gets expanded ? Bang on !! that is where parameter actions come in. Now lets see how we can set this up.
For doing this we need to use the Worksheet actions. On the top main menu bar on your tableau window, navigate to worksheet --> Actions --> Add Action --> Change Parameter. The below "Add Parameter Action" window pops up.
Step 1: Give the action a proper Name
Step 2: Source Sheets are sheets this action is applicable to. You can select more than ne sheet or dashboards here.
Step 3: Decide whether you want this action to be run when the user hovers over that selection or explicitly selects by the use of the mouse or the keyboard or the third option which is a menu item.
Step 4: Set the Target Parameter, to which the selected value should be assigned to. In our example, we are looking at the category selection. So, let's go ahead and use the "CategorySelection" parameter which we created earlier.
Step 5: Select the Data Source field as applicable
Step 6: When the user clears the selection (taps on an empty part of the dashboard), would you like the current parameter value to be retained or change it to something else.
We have now set up the Parameter Action successfully. Now lets see if it works. If you simply click on a category in the view, for example, "Office Supplies", you will immediately see that the "Furniture" expansion is now shifted to "Office Supplies" expansion. You can also see that the parameter value too is currently set to "Office Supplies" Now just do a mouse click somewhere outside of the graph and you will see that the view stays intact. This is what we defined in Step 6 above.
Let us also see what happens when the Step 6 option is changed. Let us set it to "Furniture". For doing this you will need to navigate to the same worksheet --> Actions menu and then select the already created action and then choose the edit option. In the "Edit Paramter Action" window, change the option to "Set value to" and enter "Furniture". Now once you say ok and get back to the graph, you can validate this. When you click outside of the viz, you will see that the default drilldown will be set to "Furniture category
Next, pull this viz to the dashboard and see if the graph behaves the same way. Now if you perform the same action that we did on the worksheet, to select one of the categories, you will see that the view does not react to your actions. This is happening because, when we created the action, we only set up the action to be performed on the worksheet. Now we will need to go back and add the dashboard also to the list. For this again, go to the "Edit Parameter Action" window and select both the worksheet and the dashboard as shown in the picture below and save your changes. Now, the action will be executed on the dashboard also.
We have now successfully completed setting up a Parameter Action.
Further learning: The limitation of using the parameters and parameter action is that you will need to set a specific value at any time for the given parameter. This at times, does not work, especially if you are making dashboard presentations to Top Managers, where data is unevenly displayed. There is a way to overcome this issue. Which is Set Actions. We will be exploring this in detail in my next post.