The ideal scenario is obviously to move this to the data layer when possible. (Example here: https://www.interworks.com/blog/daustin/2016/01/20/easy-year-over-year-comparisons-tableau )
Since this isn't always possible - here is an example of how I accomplish this using strictly Tableau: YoY calc
Since the data dates might not be the same as TODAY(), this solution uses the MAX() date of the data with an LoD calc.
As usual, there are a lot of different ways to accomplish this depending on your data needs! Thanks for sharing your solution!