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

Published: 28 Aug 2023
Last Modified Date: 29 Aug 2023


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


  • Tableau Desktop


The following is an example of displaying sales trend starting from dates specified by parameters.
User-added image

1.Create a calculated field and name it Days Elapsed.
2. Create a calculated field and name it Days.
DATEDIFF('day',TODAY(),[Order Date])
3. Create parameters to specify the starting point as follows;
User-added image
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"
8. Add Days Elapsed to Columns.
9. Add SUM(Days) to Detail.
10. Right-click SUM(Days) in the Marks card, and select Dimension.
11. Add SUM(Sales) to Rows.
12. Right-click Days Elapsed in Columns and select Compute Using > Days.
13. Change Mark type to Line.
14. Add Color to Color in the Marks card.
15. Right-click SUM(Sales) in Rows and select Add Table Calculations. Configure it as follows;
User-added image
Did this article resolve the issue?