7 Replies Latest reply on Aug 20, 2018 6:36 PM by lei.chen.0

    How to create calculated field as a % of the value of one of the categories rather than column total

    Yuvaraj Pazhamalai

      Hi,

       

      I want to create a calculated field which is a % distribution of another measure but instead of grand total i want it to be a % of the value of one of the labels i.e.

       

      I have a column id which has 5 values A,B,C,D,E. I have a measure variable count which is continuous.

      A - 100

      B - 80

      C - 50

      D - 30

      E - 5

       

      I want to create a calculated field %ofA which would essentially be the count as % of the value of A so the output would be:

      A-100%

      B-80%

      C-50%

      D-30%

      E-5%

       

      I tried using the formula: sum(count)/sum(if id='A' then count else 0 end)

       

      But this only works for A and not for the other categories.

       

      Appreciate any help. I am very new to Tableau.