- Bernard K
Computing Year to Date (YTD) vs Previous Year to Date (PYTD) in Tableau
Updated: Nov 29, 2022
Year to Date (YTD) – refers to the period beginning from the first day of the current calendar year or fiscal year up to the current date.
Previous Year to Date (PYTD) – refers to the period beginning from the first day of the previous calendar year or fiscal year to the date equivalent to the current day from the previous year.
To demonstrate this, I will be using the Sample-Superstore data.
Using the current date – (the function TODAY()), you can compute the year-to-date sales using any of the following formulas.
(Note, when you add any of the above formulas to the view – results to the same value, that is 448,631 for my case - which is the sales between January 1st, 2021, and the current date - September 25th, 2021.)
Using the current date again, I can compute the previous year to date sales using any of the following formulas.
(Note, when you add any of the above formulas to the view – results to the same value. That is 366,483 for my case – which is the sales between January 1st, 2020, and September 25th, 2020)
Useful: Computing week to date (WTD) vs previous week to date (PWTD)
Useful: Computing month to date (MTD) vs previous month to date (PMTD)
Useful: Computing quarter to date (QTD) vs previous quarter to date (PQTD)
I hope this article was helpful to you. To receive more of the Tableau tips, kindly join our mailing list by subscribing below.
If you like the work we do and would like to work with us, drop us an email on our Contacts page and we’ll reach out!
Thank you for reading!