5 min read
This blog series aims to introduce Tableau parameters and demonstrate how to use them in data analytics. First, we will establish what parameters are, and why they are an indispensable tool in self-service analytics. Then, we will use three use cases to illustrate how parameters can solve business problems.
- What is a Tableau Parameter
- Why are Parameters Important
- Use Cases:
In the previous blogs, we discussed why parameters are an indispensable tool for dynamically enriching business insights. Moreover, we applied parameters to solve business problems including Dynamic Benchmarking and Payback Period Sensitivity Analysis. In this final blog of this series, we will continue our journey and explore how parameters can be used to reduce noise and strengthen our insights into time-series data. More specifically, we will use parameters to create dynamic moving averages.
3.3 Dynamic Moving Average
The Business Problem:
The company wants to see how the sales of its various product lines have progressed over time. However, it is known that daily sales are very noisy (sales happen to be high on some days and low on other days). Furthermore, sales are seasonal, but different product lines may exhibit different cyclical patterns. The problem is, how can we represent varying cyclical patterns for different product lines and reduce noisy fluctuations at the same time?
We can build a single line chart for sales over time, and use a parameter to adjust the moving average period, catering to different product lines.
Step 1: Build a line chart for Sales over Order Date
- Drag Sales onto the Rows shelf and Order Date onto the columns shelf.
- Set Order Date to “DAY” frequency.
- Drag Sub-Category onto the Filters mark.
Step 2: Create a Parameter for moving average period
- Right click on an empty space in the Data Pane, and select Create Parameter.
- In the Edit Parameter window, configure the settings as below. We want to set the minimum and maximum moving average periods based on our domain knowledge. But here, I will just set the minimum and maximum to 1 and 90 days respectively.
- After creating the parameter, right click on it and select Show Parameter.
Step 3: Create a Calculated Field based on the Moving Average Period Parameter
- Right click on an empty space in the Data Pane, and select Create Calculated Field.
- Using the WINDOW_AVG(SUM([Sales], -[Moving Average Period], 0) to specify the expression.
- Place the newly created Sales Moving Avg calculated field (Step 3) onto the Rows shelf. Click on the Sales Moving Avg pill and select Dual Axis.
- Synchronize the Axis.
- Choose a pleasant but distinguishable colour for Sales Moving Avg.
Final Viz in action:
By adjusting the moving average period from 2 days to 31 days, we immediately reduce the random fluctuations and now able to see a clear cyclical sales pattern for the Accessories product line!
This is the final part of our series on Tableau Parameters and I hope you have enjoyed it!
Feel free to check out my other blogs to learn more about how Alteryx and Tableau can be used to solve business problems!