Dynamic measures in Tableau allow for the ease of comparing data across your sets. Utilizing dynamic tools in tableau encourages end users to explore the data.
This blog will explore the creation of Dynamic Measures utilizing the Superstore Data Set.
Dynamic Measures
We will explore how to create a Dynamic Measure like the one shown below:
First, we will need to create a parameter.
Parameters
To create a Parameter, right click into any blank space in the "data pane" or click on the down arrow/carrot at the top of the "data pane" and select "create a parameter".
For this example, we can call the parameter "Dynamic Measure". Select "String" as your data type, and within the 'Allowable Values' section, select the "list" option.
Within the list, insert the names of your measures and click "Ok".
Your Parameter should look like this:
Next, we must create a calculated field.
Calculated Fields
Creating a calculated field is very similar to the creation of a parameter. Clicking into the blank space, or the down arrow, there is an option to select "Create Calculated Field"
Call the Calculated Field something relevant, such as "Dynamic Measure" (Note: it is helpful to name this measure differently than your parameter for sensemaking).
Herein we can create either an "IF Statement" or a "Case Statement". This example will utilise the "IF Statement".
The IF statement will go as follows:
IF [Parameters].[Parameter Name]="Parameter List 1" THEN [Measure 1]
ELSE IF [Parameters].[Parameter Name] "Parameter List 2" THEN [Measure 2]
END IF
It should look similar to the below:
We can now construct the graph.
Construction
Dragging the "Order Date" pill, truncated by week into the column shelf, and the newly created calculated field "Dynamic Measure" into the row shelf. To reveal the Parameter drop-down, right-click on your newly created Parameter towards the base of the Data Pane and select "Show Parameter".
-- and there we have it! :)