%% Last Updated: - [[2021-02-10]] %% From: [http://talkdatatome.net/2014/05/27/plotting-two-different-time-series-on-the-same-line-graph-in-tableau/](http://talkdatatome.net/2014/05/27/plotting-two-different-time-series-on-the-same-line-graph-in-tableau/) ## Problem Two load tests cannot be compared against each other in Tableau unless they have the same axis for time, which they likely would not. ## Solution Tableau allows the creation of parameters that make this possible. Below are the parameters/calculated fields that you'll need: - _Calculated field_: **Seconds since start of run**: this will replace the timestamp parameter on your x-axis (columns). ``` DATEDIFF('second',WINDOW_MIN(MIN([Time Stamp])),MIN([Time Stamp])) ``` - _Parameter:_ **Current Test Run**: This will let you choose the run to compare to the baseline. - Add Parameter. Choose a Data Type of Integer. Choose List. Click on Add From Field. Select the field from your data that corresponds to the run ID. Click OK. In the left pane, right click on it and click Show Parameter Control. - _Parameter:_ **Reference Test Run**: This will let you choose the reference or baseline run against which the current run will be compared. Follow the same instructions to create it as for the Current Test Run parameter. - _Calculated field_: **Reference Run**: This creates the label/dimension so that you can later colour the data from the reference run differently. ``` IF([Load Test Run Id] = [Reference Test Run]) THEN "Reference Run: Run " + STR([Reference Test Run]) ELSE "Hide" END ``` - _Calculated field_: **Current Run**: This creates the label/dimension so that you can later colour (etc) the data from the current run differently. ``` IF([Load Test Run Id] = [Current Test Run]) THEN "Current Run: Run " + STR([Current Test Run]) ELSE "Hide" END ``` - _Calculated field_: **Test Run**: This combines the Reference Test Run and the Current Test Run so that you can drop this field into the colour or shape filters and sort between both. ``` IF([Reference Run]!="Hide") THEN [Reference Run] ELSEIF([Current Run]!="Hide") THEN [Current] END ``` ## Steps - Create all the parameters and calculated fields as described above. - Drag the Seconds Since Start Of Run field to the Columns shelf. - Click on the arrow next to the Seconds Since Start of Run field on the shelf and click Compute Using > Time Stamp. - Drag Response Time field to the Rows shelf. - Drag the Test Run calculated field to the Filters column and exclude Null values. - Drag the Test Run calculated field to the Colours shelf. - Change the Reference and Test Run parameters by selecting the appropriate runs from the list as needed.