top of page
Search

Tableau: Compare Same Period Last Year



Step 1:

Create a crosstab by dragging order date to rows, and sales to the text shelf. In this data, we only have December 2019 and 2020. In 2020, the data ends at the 20th of the month.





Step 2:

Create a calculation for this year sales by using this calculated field.


if year([Order Date]) = year({Max([Order Date])}) then [Sales] END





Step 3:

Copy the calculated field and modify it for last year.


if year([Order Date]) = year({Max([Order Date])})-1 then [Sales] END






Step 4: