3 Replies Latest reply on Dec 6, 2013 7:11 AM by Chandra Shekhar Jain

    Knotted in Addressing and Partitions.

    Chandra Shekhar Jain

      Want to put in an Average Growth Line in % Difference in Qty Column using the Add Reference Line. (Not Simple Average but Weighted Average). A simple average I could do using the readily available option in the Add Reference Line.


      Tableau Forum Question.png.


      For the weighted average , I created a calculated field and put it in the Detail.


      The Formula for the Calculated Field is


      1-zn(window_sum(sum([Qty])))/zn(lookup(window_sum(sum([Qty])),1)) 


      or in plain words

       

      1 - (Subtotal for the Category for Current Year / Subtotal for the Category for the Previous year)


      Example (See Pic Below)


      For Scotch (Beverage) and Category (Regular)  it would be  1 - 50,751/45,396


      However either I am unable to put in the right Addressing and Partitioning in the Advanced Option in the Calculated Field or my Calculation is wrong.


      Any help will be greatly appreciated. (I may not be able to share the full twbx file as is)