Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
It is possible to use reference lines in order to extend an axis without using a 'fixed' range in the 'Edit Axis' menu. The following instructions can be reviewed in the attached workbook.Step 1 : Build the View
- Right click and drag Order Date to Columns and select Quarter (Order Date) as a continuous field.
- Drag Sales to Rows
- Drag Profit to Rows.
- Right click on Profit and select Dual Axis.
- On the Profit Axis, right click and select Synchronize Axis.
- On the Sales Mark Card, change the Chart to Bars.
Step 2: Create a new calculated fields for Canada
- Select Analysis > Create Calculated Field
- In the Create Calculated Field dialog box, do the following and click OK:
- Name the field. In the example, this field is called "Reference Line" and enter the following formula:
DATEADD('year',5,{ MAX([Order Date]) })
Note that this can be adjusted by using different formulas to fix the range anchored to the min/max of the data set (entire or view).
Step 3: Add the reference line to the view
- Right-click and drag "Reference Line" to Details on the All Marks
- Select Year (Reference Line) as a continuous field.
- Right click the Quarter (Order Date) Axis and select Add a reference line
- Set the Value to use the calculated field (Reference line in this example), set Label to 'None' and Line to 'None'.
- (Optional) Click on Tooltip and remove the reference to the newly created date field.
- (Optional) It is possible to make the amount of time units in the 'DATEADD' function a parameter.
Additional Information
To view these steps in action, see the video below:Note! The video has no sound.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials
Trending Articles
Results 1-3 of 50