In my previous and first blog post about parameters I gave an introduction and an explanation about why parameters are useful and how we can use them, focusing on “threshold control”. Here the blog post about it.
In this second part, I am going to write about “What if analysis” using parameters. But first, let’s give a definition and explain the meaning of it!
What is a “What if analysis”?
It is the process of changing one (or more) variable value(s) – such as a factor, a constant – to see how those changes will affect the outcome. It is very useful to simulate different scenarios, whether positive or negative, in order to make decisions.
I will do a simple example of what if analysis with parameters in Tableau.
I am using Sample Superstore.
I want to do a what if analysis on Sales by product subcategory.
- Let’s start to build a view showing sales by product sub-category as below:
- Create a parameter and set the options as below:
[ This will generate a parameter that can vary between -100% (specified as -1) and 100% (as 1) with a step size of 5% (0.05). ]
3. You will need then to create a calculation to activate the parameter and generate the Sales Forecast field. The calculation will look like
[Sales]*(1+[Sales forecast % value])
Basically, when Sales forecast % value parameter will be set up at 0, this would means that Sales Forecast=Sales.
4. Now, drag Sales Forecast field on Sales axis and this will generate Measure Names and Measure Values. You will get the view below:
5. To finish just a bit of formatting and clean up (for example, you could remove the grid lines and also hide the detail Sales, Sales Forecast on the left hand side that is quite repetitive and only keep the colour legend.
Below the final view:
I hope you enjoyed this post!