Using QuickSight parameters and controls to drive interactivity in your dashboards
Amazon QuickSight added support for parameters, on-screen controls, and URL actions earlier this year. In this blog post, we walk through several examples to show how you can use these capabilities within interactive dashboards for your audience.
Parameters are new variables that you can add to your dashboards. You can use parameters in Amazon QuickSight for filtering, for allowing users to customize what data is being used in the visual, for what-if analysis, and also to drill through from one dashboard to another. After you create a parameter, you nearly always create a control for it. These controls allow your users to change the value of the parameter with intuitive UIs like drop-downs, slider bars, text boxes, and date selectors. A value set for the parameter becomes available in the context of the dashboard.
Keep in mind that parameters and their controls don’t affect any of your visuals unless you use or reference the parameter somewhere else, such as in a filter, calculated field, or URL action. After you use your parameter in one of these places, your users (readers who have access to your dashboard) can use the control to interact with your dashboard in new ways. If you don’t create a control, you can pass a value to your parameter using the dashboard’s URL. For more details, see the Amazon QuickSight documentation.
URL actions enable you to launch any URL from a given data point in a visual and pass the user to another webpage. You can also pass values into the URL so that they are dynamic. For a simple example, suppose that you have a column in your data that contains a URL. In this case, you can create a URL action in Amazon QuickSight and pass that whole field as the URL to launch when a user clicks a given data point. In addition to launching URLs, you can also trigger other URIs like mailto: to trigger an email compose window to open as an action result. For more details, see the Amazon QuickSight documentation.
Let’s jump into some use cases and see how we can use these features.
Use case 1: adding easy filter controls on your dashboards
Within Amazon QuickSight, you can create filters that affect either one visual, multiple visuals, or all the visuals that use the related data set in your analyses and dashboards. You can find these filters in a panel on the left side of the screen, which users can expand to change the filters. Amazon QuickSight allows advanced filtering through use of all fields present in the data set and use of and/or conditions between clauses. However, if you want to add more quick and easy filters, such as drop-downs, search boxes, or slider bars, we can use parameters and controls to perform the filtering.
To create the parameter, choose + Add in your analysis, and then choose Add parameter. Give it a name and choose the data type for the parameter. If you want a text box or drop-down, choose String.
You can optionally set a default value or a dynamic default value per user. Dynamic defaults allow you to set a custom default value depending on the viewer of the dashboard, which can enable a personalized view for each user. After the dashboard is loaded, the viewer can change the default if desired.
After you choose Create, it prompts you to create a control, a filter, a calculated field, or a custom action to use the parameter. Choose Control first.
This control is what the users see on the dashboard. Because we chose a String parameter type, we get the options to use a text box or a drop-down for our control. Choose Drop down.
Next, we need to tell Amazon QuickSight what the choices or values should be when using the drop-down. Although you can enter specific values manually, we can also link the values to a field from the data set. Doing this is useful if you want the choices or values in the drop-down menu to update whenever new values are added to a given column in your data. In other words, doing this makes the parameter values dynamic—as your data changes, so do the values in the drop-down.
After you choose Apply, you see the control on the top of your analysis. If the Controls section is collapsed, click it and it will expand.
Now use the parameter somewhere. In this example, we use it in a filter. On the left of your screen, choose Filter and add a filter for the field you want this parameter to control. In this example, we use the segment field.
In the filter settings, change it to Custom Filter, select Use parameters, and then select the parameter we created earlier.
Note: After you check Use parameters, you might see a prompt asking if you want to change the scope of the filter to affect all visuals. If you want the filter to apply to all the visuals from the data set, then choose Yes. Otherwise, the filter only affects the visual that was selected when you created the filter.
Choose Apply on your filter. Now you can play around with the control, and it will filter all visuals that use that data set! Notice that when you change the values, your visuals are filtered.
This was a simple first example, where we added one parameter and one control to filter both visuals on our dashboard. You can repeat these steps to add more parameters, controls, and filters to your dashboard.
Use case 2: filtering across multiple data sets
In the last example, our parameter and control filtered all the visuals on our dashboard, and all our visuals shared the same data set. What if we use multiple data sets in our dashboard, and we want to filter across them using a single control? This is another great use of parameters.
Consider the dashboard following, which uses two data sets: Web Orders and Web Analytics. They might be from the same type of data source (such as Amazon Redshift), or they might be from completely different data sources (such as Amazon Redshift and Microsoft Excel or Amazon Athena, and so on).
Very similar to the first use case, we create a parameter and a control. When creating the control and linking it to a field in the data set, choose the column that is common to the two data sets to be the values (in this example, we use State). You can choose the column from either data set, or enter the values manually in the control defaults.
Now that we have our parameter and control created, we add a filter to each data set that references this parameter. Choose your first visual, which uses Data Set 1 (Web Orders), and add a filter for the column that represents State.
Repeat for the second visual, which uses data set 2 (Web Analytics).
Now you have added both filters, you should see that your control now affects both visuals, even though they are using different data sets.
Use case 3: using parameters in calculated fields to allow users to select what column to display in a visual
Besides using them for filtering, you can use parameters and controls to drive all kinds of interactivity when you use them inside of calculated fields. In this example, we use an ifElse() statement inside a calculated field in a direct query data set to allow our users to select what metric they want to display in the visual or visuals. This is just one use case—there are myriad possibilities with using parameters along with calculated fields.
Going back to the visuals used in the first example, the situation is we now want to allow our users to select what metric is displayed in the KPI and bar chart. First step, we create a parameter and a control for KPIMetric. When creating the control, instead of choosing Link to a data set field, we choose Specific values. Then we type in the names of the fields that we want our users to choose among. The names don’t need to match the field names exactly—they can be more user-friendly.
Now we create a calculated field by choosing + Add and then choosing Add calculated field.
The main concept here is to use the ifElse() function to look at what the user has selected in the parameter control and then return a metric accordingly. Following is the formula, along with what it looks like in the calculated field window.
The result of this calculation is a metric (a decimal field). We can drag this result to any field well that we like, and our parameter control drives which metric is actually plugged into it.
Finally, see how both visuals change when you change the parameter control.
In this example, we use the parameter to allow the user to select what metric was being plotted in the visual. Keep in mind that you can use this same technique to allow the user to select what dimension is used on a given axis or as the color grouping.
Use case 4: using parameters and URL actions to connect one dashboard to another
Another way to use parameters is to allow users to drill from one dashboard to another. You might have some summary metrics on your main dashboard but also have multiple other dashboards that contain more details about a given subject area. Being able to launch another dashboard and optionally send filter values by using the URL is a great way to organize drill paths for your users.
In this example, we launch a second dashboard from the first one and send a filter by using a parameter value in the URL. Consider a similar dashboard in use case 2, where we have sales metrics along with website traffic metrics on the same summary dashboard. I have a second dashboard that is dedicated to the website traffic metrics and contains much more detail.
Go back to the analysis that was used to publish dashboard 1, click the arrow in the upper-right corner of the WoW Impressions visual, and choose URL actions.
The Action name is what the user sees when they choose a data point. The URL is the destination dashboard (dashboard 2 in our example). Both of these can accept dynamic values by adding fields using the + button on the right.
The example preceding takes the user to dashboard 2 but doesn’t apply any filters. If you want also to apply filters, we can add the parameters into the URL. For instance, if we have a parameter in dashboard 2 called Source that is used as a filter, we can filter the dashboard by the URL like this:
Let’s create a second URL action on that visual, which not only launches Dashboard 2, but also drills down to the Source the user clicked in dashboard 1. (You could also add the week as a drilldown by creating parameters in each dashboard for the week and used them to filter the week field too.)
Let’s see what this looks like from dashboard 1. Notice that it dynamically passes in the Source value into Action name.
After we choose it, we go to Dashboard 2. The parameter is automatically set to Referral, which filters our whole dashboard to just Source=Referral data.
In summary, you can use parameters, on-screen controls, and URL actions to create more engaging and interactive Amazon QuickSight dashboards. We saw some of the most common use cases in this blog post, and hope that these will be useful in your Amazon QuickSight journey.
If you found this post useful, be sure to check out Amazon QuickSight now supports Email Reports and Data Labels, and 10 visualizations to try in Amazon QuickSight with sample data.
About the Author
Jesse Gebhardt is a senior global business development manager focused on analytics. He has spent over 10 years in the Business Intelligence industry. At AWS, he aids customers around the globe gain insight and value from the data they have stored in their data lakes and data warehouses. Jesse lives with his wife and mini Australian Shepherd in sunny Phoenix, and is an amateur electronic music producer.