How to create a What-If analysis in Tableau

Discover what can powerful parameters do for your data visualization and at the same time learn how to create a What-If analysis in Tableau. When the value of a parameter changes, also the result of the view changes. If you like video tutorials, follow the recording of the entire process of creating a What-If analysis as you can see in the #skillpill video below, by our colleague Dragoș Cojocaru, Data Analyst@btProvider.

 

Happy data analysis! Here are the written steps:

 Step 1: Connect to data

In Tableau Desktop, connect to Sample – Superstore sample data provided by Tableau.

Step 2: Create the parameters & Calculated fields

→From the Data pane, create a Parameter (use the small triangle near the search bar)

→In the Create Parameter window, change the Name to Growth %

→Change the Display format: from Automatic to Percentage

→On the Allowable values click Range

→Under Range values change the Minimum to -1, the Maximum to 1 and Step size to 0.01 and then click Ok.

→Create another Parameter by following the steps above and Name it Churn Rate % and under Range Values change the Minimum value to 0.

→Select Analysis > Create Calculated Field to create a calculated field

→In the Calculated Field dialog box that opens, enter a name for the field. In the example workbook, this field is named Forecast Sales

→In the formula field, create a calculated field similar to the following, and then click OK:
[Sales]*(1+[Growth %])*(1-[Churn Rate %])

Step 3: Create the table and bring the parameters in the view

→From the Data pane, drag the Order Date dimension to Columns and click on the plus sign until you open Year, Quarter, Month

→Drag the Year (Order Date) from the Columns into the Filters Pane and select Years, Click Next, Select ALL, then press OK

→Right-click the Year(Order Date) in the Filters Pane and click on Show Filters, on the right side you will find the Year(Order Date), here, click on the right side of the panel and select Single value list

→From the Data pane, drag the Region and Segment dimensions to Rows

→From the Data pane, drag the Sales measure to Text, under Marks

→From the Data pane, drag the Forecast Sales in the table that you created

→From the Data pane, under Parameters, right-click the Churn rate % and Growth % parameters and select Show Parameters

→Move the parameter slider to see changes in the Data.

Step 4: Create a What-If analysis for two segments in your data

→From the Data pane, under Parameters, right-click the Growth % parameter and select Duplicate

→Right-click the Growth % (copy) Parameter and press Edit.

→In the Parameter window change the Name to Growth % East

→From the Data pane, under Parameters, right-click the Growth % parameter and select Duplicate

→Right-click the Growth % (copy) Parameter and press Edit.

→In the Parameter window change the Name to Growth % South

→Select Analysis > Create Calculated Field to create a calculated field

→In the Calculated Field dialog box that opens, enter a name for the field. In the example workbook, this field is named Forecast Sales East

→In the formula field, create a calculated field similar to the following, and then click OK:
IF [Region] = “East” THEN [Sales]*(1+[Growth % East]) ELSE 0 END

→Create another calculated field named Forecast Sales South

→In the formula field, create a calculated field similar to the following, and then click OK:
IF [Region] = “South” THEN [Sales]*(1+[Growth % South]) ELSE 0 END

→Create another calculated field named All regions with East/South

→In the formula field, create a calculated field similar to the following, and then click OK:
IF [Region] = “East” or [Region] = “South” THEN 0 ELSE [Sales] END

→Create another calculated field named New Forecast Sales

→In the formula field, create a calculated field similar to the following, and then click OK:
[All regions with East/South]+[Forecast Sales East]+[Forecast Sales South]

→From the Data pane, drag the New Forecast Sales in the table that you created

→From the Data pane, under Parameters, right-click the Growth % East and Growth % South parameters and select Show Parameters

→Move the parameter slider to see changes in the Data.

About btProvider:

 We hold the technical and sales certifications for all products: Tableau Desktop, Tableau Server, Tableau Prep, Tableau Data Management.

With Tableau Software – the best data visualization platform – you can always understand your business or your job better. Using Tableau, you will take smart and strategic decisions and you will quickly understand the data flow, numbers and results it produces.

Are you interested in learning more about one of the best analytics tools and implement the solution in the entire company? Contact us!