1 Reply Latest reply on Jun 25, 2016 5:23 AM by Gibson Wasukira

    Percentage Difference in calculated fields

    Gibson Wasukira

      Tableau newbie here

       

      I have 2 calculated fields

       

      1. MTD with the formular

          IF [Date] <= [Dated] AND DATEDIFF('month',[Date],[Dated])= 0 THEN [Sales] END

      2. PMTD

      IF

          DATETRUNC('month', [Date]) =

          DATETRUNC('month', DATEADD('month', -1,[Dated]))

          AND

          DATETRUNC('day', [Date]) <=

          DATETRUNC('day', DATEADD('month', -1,[Dated]))

      THEN

          [Profit]

      END

       

      I need to get the percentage difference between the 2 PMTD - MTD, I have created a calculated field for this in the using the formula

      (ZN([MTD])/ZN([PMTD]))-1

       

      Its however not returning the expected result

       

      ZN([MTD])/ZN([PMTD]) however returns the expected difference between the 2, i am not sure what goes wrong

       

      I have attached my workbook