3 Replies Latest reply on Nov 28, 2016 9:32 AM by Norbert Maijoor

    MOM comparison (incl. offsetting the days)

    Hannah Williams

      Hi All

       

      I am running some month on month and year on year comparison.

       

      However the data is more meaningful if I compare MOM or YOY based on the same day. So in my month on month example above, I would want the first date to be the 3rd October (the nearest Monday).

       

      Below is my calc for the MOM, I am using this mothod: https://interworks.co.uk/blog/date-comparisons-tableau-made-easy/

       

      IF DATEDIFF([Period Type],[Run Date],[Date Comparisom Use]) >=0 AND DATEDIFF([Period Type],[Run Date],[Date Comparisom Use])< [Period Length] THEN 0

      ELSEIF DATEDIFF([Period Type],[Run Date],DATEADD('month',-1,[Date Comparisom Use])) >=0 AND DATEDIFF([Period Type],[Run Date],DATEADD('month',-1,[Date Comparisom Use])) < [Period Length] THEN -1

      END

       

       

      Any ideas how I could adjust my calculation to achieve this?

       

      Thanks