0
0
Tableaubi_tool~15 mins

Dynamic measure swap in Tableau - Real Business Scenario

Choose your learning style9 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants a dashboard where users can choose which sales metric to view: Total Sales, Profit, or Quantity Sold. The dashboard should update dynamically based on the user's choice.
📊 Data: You have monthly sales data including Date, Region, Product Category, Total Sales, Profit, and Quantity Sold.
🎯 Deliverable: Create a Tableau dashboard with a parameter to select the measure and a chart that updates to show the selected measure by month.
Progress0 / 5 steps
Sample Data
DateRegionProduct CategoryTotal SalesProfitQuantity Sold
2024-01-01NorthElectronics100002500150
2024-01-01SouthFurniture80001200100
2024-02-01NorthElectronics120003000180
2024-02-01SouthFurniture7000100090
2024-03-01NorthElectronics150004000200
2024-03-01SouthFurniture90001500110
2024-04-01NorthElectronics130003500170
2024-04-01SouthFurniture85001300105
1
Step 1: Connect to the sales data source in Tableau and load the data.
No formula needed; just connect and import the data.
Expected Result
Data is loaded and visible in Tableau's Data pane.
2
Step 2: Create a parameter named 'Select Measure' with string data type and list of values: 'Total Sales', 'Profit', 'Quantity Sold'.
Parameter configuration: Name='Select Measure', Data type=String, Allowable values=List, Values=['Total Sales', 'Profit', 'Quantity Sold'], Current value='Total Sales'.
Expected Result
Parameter 'Select Measure' appears in the Data pane and can be used in calculations.
3
Step 3: Create a calculated field named 'Dynamic Measure' that returns the measure selected by the parameter.
IF [Select Measure] = 'Total Sales' THEN SUM([Total Sales]) ELSEIF [Select Measure] = 'Profit' THEN SUM([Profit]) ELSE SUM([Quantity Sold]) END
Expected Result
Calculated field 'Dynamic Measure' correctly computes the sum of the selected measure.
4
Step 4: Build a line chart with 'Date' on Columns and 'Dynamic Measure' on Rows.
Drag 'Date' to Columns shelf, drag 'Dynamic Measure' to Rows shelf, set 'Date' to continuous month.
Expected Result
Line chart shows the trend of the selected measure over months.
5
Step 5: Add the 'Select Measure' parameter control to the dashboard for user interaction.
Right-click 'Select Measure' parameter and choose 'Show Parameter Control'.
Expected Result
Parameter control appears on the dashboard allowing users to switch measures dynamically.
Final Result
Date       | Dynamic Measure (Selected)
----------------------------------------
2024-01   *  
2024-02    * *
2024-03     * * *
2024-04      * *

* = Value points on line chart

User selects measure from dropdown: Total Sales, Profit, or Quantity Sold
Chart updates accordingly.
Users can easily switch between Total Sales, Profit, and Quantity Sold to analyze trends.
The dynamic measure swap saves space and improves dashboard usability.
Monthly trends reveal sales and profit peaks in March.
Bonus Challenge

Add a second parameter to select Region and update the chart to show the selected measure for the chosen region only.

Show Hint
Create a 'Select Region' parameter with region names, then update the 'Dynamic Measure' calculated field to filter data by the selected region using an IF statement.