Calculating Year to Date Versus Previous Year to Date in Tableau

By: Eric Parker

Pro Headshot.jpg

Eric Parker lives in Seattle and has been teaching Tableau and Alteryx for 5 years. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.

There will likely be times when you want to calculate performance year to date versus the same time period prior year to date.

The output might look something like this:


It takes a handful of calculations to do this. We’ll start by creating a year to date calculation:


Next we’ll create a previous year to date calculation:


The combination of the DATEPART() function and the ‘dayofyear’ date value is pivotal here. The way this works, 2/1/17 would be returned as day of year 32.

Last we’ll create a calculation that finds the growth percentage this year:


After adjusting the % growth calculation to have a percentage number format our results looks like this:



Need more help? Sign up for an office hour to get some extra help!