1 Reply Latest reply on Apr 3, 2013 11:18 AM by Tracy Rodgers

    Identify latest month in my data for "current month vs. same month last year" comparison

    Max Pawelke

      Hi:

       

      I am looking for a way to have Tableau identify the latest data month in my data feed automatically via a calculated field in order to calculate a "current month vs. same month last year" comparison without manual intervention.

       

      Currently, I am using a parameter (as a date reference field; see details on my approach below) which requires a manual update upon receiving an updated data feed (with an additional month of data).

       

      Any suggestions or ideas on how to accomplish this?

       

      Here are the details (packaged workbook with details attached):

       

      Every month I receive a data feed with “Unit Sales” by month and product with a total of 72 months of history. My January data feed contain data from February 2007 through January 2013. My February data feed will contain data from March 2007 through February 2013 and so on.

       

      I created a Tableau workbook to look at the following comparisons for my “Unit Sales”:

      • Current Month (Latest Month in data feed) vs. Previous Month
      • Current Month (Latest Month in data feed) vs. Same Month Last Year
      • YTD vs. YTD Last Year

       

      I am using a parameter as the reference date for the current date and my calculated fields look as follows (using the "Unit Sale YTD" as an example):

       

      if DATEDIFF('year',[Date],[Reference Date])=0

      and month([Date]) <=month([Reference Date])

      then [Unit Sales] end

       

      Again, looking for a way to replace the reference date parameter (and having to manually update it) with some sort of formula that can identify the latest month in my data.

       

      Thanks for your help in advance!