Comparing Prior Year Data by Month

Published: 17 Sep 2013
Last Modified Date: 10 Oct 2017


How to create a monthly year-to-date comparison filterable by calendar month.


Tableau Desktop


The following instructions can be reviewed in the workbook attached below.
  1. Open Tableau Desktop and select Analysis > Create Calculated Field to create a calculated field.
  2. In the Calculated Field dialog box, enter a name for the field. In this example, the field is named "Prior Sales".
  3. In the formula field, create a calculated field similar to the following and click OK:
  4. Drag Order Date to the Rows shelf, and then click the plus sign (+) on the YEAR(Order Date) field to expand to QUARTER(Order Date).
  5. Right-click on QUARTER(Order Date) and select Month.
  6. Double-click Sales and Prior Sales in Measures to add them to the view.
  7. Right-click on Prior Sales on Measure Values, and select Edit Table Calculation.
  8. Under Compute using, select Advanced.
  9. Move Month of Order Date and then Year of Order Date from Available Fields to Compute Using. Click OK.
  10. From the At the level drop-down menu, select Year of Order Date.
  11. From Restarting every drop-down menu, select Month of Order Date, and then click OK.
  12. Right-click MONTH(Order Date) on Rows and select Show Quick Filter.
Did this article resolve the issue?