Last Modified Date: 29 Nov 2019
Environment
Tableau DesktopAnswer
Step 1 - Create the parameter:
- Right-click the Parameters pane and select Create Parameter....
- Name the parameter This Year.
- Under Data Type select Integer.
- Under Allowable Values select List.
- Enter 2010, 2011, 2012, and 2013 in the list of date values.
- In the Display Format drop-down menu, select Number(Custom).
- Enter 0 for the number of decimal places.
- Clear the selection for Display thousands separator.
- Click OK.
- Right-click This Year and select Show Parameter Control.
Step 2 - Create the calculated fields:
- Go to Analysis > Create Calculated Field....
- Name the calculated field This Year Profit.
- In Formula enter
IF YEAR([Order Date]) = [This Year] THEN [Profit] END
. - Repeat steps 1-3 with name Last Year Profit and formula
IF YEAR([Order Date]) = [This Year] - 1 THEN [Profit] END
.
Step 3 - Build the view:
- Drag Customer Segment to the Rows shelf.
- Drag This Year Profit to the Column Shelf.
- Drag Last Year Profit to the Column Shelf.
Additional Information
To view the above steps in action, see the video below.Note: the video is silent.
Discuss this article... Feedback Forum
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