How to Tableau: Year to Date vs Previous Year to Date (Video)

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. You can also sign up for a Tableau Office Hour to work with him directly!

One of the most popular blog posts on the OneNumber blog was Calculating Year to Date Versus Previous Year to Date in Tableau.

Tableau doesn’t have a great native feature for comparing year to date values to the same time period from the previous year, but it can be accomplished with a few calculations!

We’ve updated our approach since the original blog post above, so we wanted to revisit the concept in a video form!

Want to learn even more? Join us next week for our webinar Mastering Tableau Date Calculations, it’s free!

No time to watch? No problem. Grab the calculations here:

Sales - YTD

IF DATEDIFF('year',[Date],TODAY()) = 0

AND [Date] <= TODAY()

THEN [Sales]

END

Sales - PYTD

IF DATEDIFF('year',[Date],TODAY()) = 1

AND DATEPART('dayofyear',[Date]) <= DATEPART('dayofyear',TODAY())

THEN [Sales]

END

Sales - Difference YTD v PYTD

SUM([Sales - YTD]) - SUM([Sales - PYTD])

Mastering Tableau Date Calculations - Webinar Recording

The Summer of '98 - Sports, Stats and My Earliest Foray into Analytics!

0