Last Modified Date: 16 Jan 2019
- Tableau Desktop
AnswerDCreate two calculations:
Previous Year Sales
str(LOOKUP(max(DATEPART('year', [Order Date])),0))
Note: It is not necessary to wrap the
!DateFiltercalculation in a string, but it removes the commas and makes it look more like a date.
By Using the
!DateFilteron the filters shelf (make sure to change to Discrete), you can filter the view down to just a single year, and have our Previous Year Sales as a measure value underneath our regular Sales.
See the example workbook for how to use these calculations .
Discuss this article...
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials