Tableau features always allow us to display in a dashboard or in a graph the information we need. As we have shown many times in our posts, Tableau gives its users the flexibility they need to explore and visualize data in different ways. In today’s post we will show you how you can swap views with parameters in the same dashboard. We’ll see how we can explore data at different levels in the same view.
Many times, in our blog section we want to show our visitors and Tableau users which are the most suitable graphs or views that should be used in different situations. Of course, each user has his preferences, and the way he wants to explore certain data also depends on how he identifies and understands the information in his analysis. But most of the time our suggestions can be considered as a guide for analyzing several types of data.
In the following we will show you how you can swap views with only one parameter. In general, we use this feature offered by the parameters we can create in Tableau when we want to analyze certain data at different levels or in certain periods of time. For example, if we want to visualize what sales have been over several years, but at the same time have the flexibility to select the period we are interested in, we can use a parameter to change the visualization according to our selection.
Also, we can see what the total sales is recorded in all areas where, for example, our company sells products, or we can see which were the areas with the highest or lowest sales recorded. The advantage of this feature offered by parameters in Tableau is given by the fact that we do not have to leave the dashboard to access and explore the data we need. Last but not least, we have more flexibility in terms of the information we want to display in our analysis and flexibility in how we interact with the final view.
Below in the video you will see how you can swap views with parameters in Tableau.
→ In Tableau Desktop, connect to Sample Superstore.
→ Create calculated field as DATETRUNC(‘month’,[Order Date]) – Month
→ Change data type to date
→ Create new parameter Date Month having Date data type, select Range and click Set from field -> Month, and tick Step size -> 1 Month
→ Create new calculated field Total Sales as (If [Order Date] >= [Date Month] then [Sales] else 0 end)
→ Duplicate the field and rename it as Stacked Sales, and change the formula to If [Order Date] >= [Date Month] then [Sales] else 0 end
→ Add Month to columns and select Continuous Month
→ Add Total Sales and Stacked Sales to Rows
→ Select Dual Axis and Synchronize Axis
→ Change the chart type to bars
→ Drop Category to Color in Stacked Sales chart
→ Select any Gray color for Total Sales
→ Click on the Month axis and select Add reference line
→ Select the Date Month parameter
→ Hide both headers for column axes
→ Create the dashboard and add the parameter slider on top of the chart
By Andrei Stan