Compare to the Same Day Last Year 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.

Let’s say you want to compare a value from today to the same day last year to evaluate performance. Creating the calculated field for today’s value looks like this:

To compare to exactly this day (April 23rd as of this writing) last year, you would want to create something like this:


Here’s the result of these two calculations:


Let’s say your scenario is more complicated though. You want to compare to the closest comparable weekday last year. April 23rd is a Monday so we want to compare to the closest Monday in April of last year. In that case we would want a calculation like this:


With that calculation we ensure we are looking at data from last year, it is from the same week number as last year, and it is the same weekday as well. Here’s the result (which ends up being a much closer comparison):


Have an even more complicated scenario than that? It's possible. You may need to build a custom calendar and import it into Tableau as an additional data source. If you think that's the case, you can sign up for an office hour and we'll help you build and implement the data source you need.