In this seventh part of the series parameter actions we will see how to use parameter actions to compare sales of a month one year prior. In case you have not yet gone through our earlier blogs, you can do so by visiting them here.
Let us imagine a scenario in which we have a monthly trend line as below:
What we are required to do is that if a user hovers on a particular point ie a month , he is able to see the sales of the that particular month as well as a year prior to it and also see the change in sales.So if we hover on March 2014 then we are able to see the sales of March 2013 as well as how the sales has changed. This can be easily done using parameter actions. Let us see how to do that step by step.
Step 1 : Import the sample superstore data in Tableau.
Step 2 : Create a trend chart by dragging order date in Columns and sales in Rows.
Step 3: Create a date parameter to select the date for which we need the sales to be displayed.
Step 4: Create a calculated field to find the sales for the date selected in parameter as under.
There you go , now if you hover on any point on the trend chart you will see the sales being displayed for the selected month as well as a year before.
You can also create a calculated field to find the change in sales and bring them all together in a dashbaord . Here is a interactive version of the steps that we followed. Hover on any point on the trend line and you will be able to see the sales for that point as well as sales one year prior with the percentage change.
Reach out to me in case if you are not able to follow the above steps.
Hope you guys enjoyed reading this blogpost.
Stay tuned for more interesting posts to come in this series of parameter actions.