10 Replies Latest reply on Jul 6, 2018 1:21 PM by Helen Wang

    How to automate the calculation for quarter over quarter ratio

    Helen Wang

      Hello everyone,

       

      I am working on a Tableau Dashboard. My current dashboard requires a calculation, which is listed below:

       

      (Current quarter on quarter management DA):

      QoQ Cur Q MGT DA

      [Q2'18 MGT DA ]/[Q1'18 MGT DA ]-1

       

      Below is the formula of how I get :[Q2'18 MGT DA ]

       

      Q2'18 MGT DA

      ZN(IF str(DATEPART('year',[Fiscal Quarter] ))= '2018' AND str(DATEPART('quarter',[Fiscal Quarter] )) ='2'

      THEN [Ship Final Act-Fcst]

      END)

       

       

      Below is the formula of how I get :[Q1'18 MGT DA ]

       

      Q1'18 MGT DA

      ZN(IF str(DATEPART('year',[Fiscal Quarter] ))= '2018' AND str(DATEPART('quarter',[Fiscal Quarter] )) ='1'

      THEN [Ship Final Act-Fcst]

      END)

       

       

      : I want to automate the current quarter to quarter calculation.

      It will be just how to index the current quarter [Ship Final Act-Fcst] and the previous quarter [Ship Final Act-Fcst]

       

      It would be great if anyone may give me advice on how to write a code like that. Thank you!