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 since 2014. 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.

(Prefer a video? Check out our 2021 updated video for Year to Date vs Previous Year to Date here!)

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:

36-1.png

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

36-2.png

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

36-3.png

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:

36-4.png

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

36-5.png

 

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

Viz in Tooltip - Tableau's Latest Breakthrough

Why am I getting a * in Tableau?

0