2 Replies Latest reply on Jul 15, 2015 6:17 PM by David Edwards

    Previous Month Total for Previous Year

    David Edwards

      Hi Tableau Guru's,

       

      I'm new to Tableau and have been looking on the forum to try and find a solution to my problem, but I can't find anything that matches to what I need. I'm having trouble creating a cross tab that shows last months sales totals compared to last year's total for the same month.

       

      Here's how I calculated last month's totals:

       

      IF DATEDIFF('month',[DATE],TODAY())=1,

      THEN [SALES]

      END.

       

      I tried to use the same sort of logic to build the formula for the same month for last year:

       

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

      AND

      DATEDIFF('month',[DATE],TODAY())=1

      THEN

      [SALES]

      END

       

      However it doesn't work. It looks like my assumption on how to build this was wrong. Any help would be greatly appreciated!!!