KNOWLEDGE BASE

## How to Compare Line Charts from a Common Starting Point Rather Than over an Absolute Timeline

Published: 28 Aug 2023

### Question

How to compare line charts from a common starting point rather than over an absolute timeline.

### Environment

• Tableau Desktop

The following is an example of displaying sales trend starting from dates specified by parameters. 1.Create a calculated field and name it Days Elapsed.
`INDEX()`
2. Create a calculated field and name it Days.
`DATEDIFF('day',TODAY(),[Order Date])`
3. Create parameters to specify the starting point as follows; 4. Duplicate Starting Point 1 parameter and create as many parameters as needed. In this example, duplicate the three parameters and name them Starting Point 2 through Starting Point 3.
5. Right-click each parameter and select Show Parameter. Specify the starting dates for each parameter.
6. Create calculated fields with the same name as the parameters.
`[Parameters].[Starting Point 1]`
`[Parameters].[Starting Point 2]`
`[Parameters].[Starting Point 3]`
`[Parameters].[Starting Point 4]`
7. Create a calculated field and name it Color.
```IF [Order Date] >= [Starting Point 1] AND [Order Date] < [Starting Point 2] THEN "Starting Point 1"
ELSEIF [Order Date] >= [Starting Point 2] AND [Order Date] < [Starting Point 3] THEN "Starting Point 2"
ELSEIF [Order Date] >= [Starting Point 3] AND [Order Date] < [Starting Point 4] THEN "Starting Point 3"
ELSEIF [Order Date] >= [Starting Point 4] THEN "Starting Point 4"
END```
8. Add Days Elapsed to Columns.
10. Right-click SUM(Days) in the Marks card, and select Dimension. 