2 Replies Latest reply on May 20, 2013 5:48 AM by Sahil Sampat

    Calculated Measure

    Sahil Sampat

      Hello All,

       

      I'm trying to find my way around Tableau and had a question regarding a calculated measure.

       

      I have 3 columns in my table.

       

      Column 1: Sr. no. - The values range from 1 to 44

      Column 2: Color - The values it can take are Red, Blue, Yellow

      Column 3: Score

       

      My requirement is, for each Sr. no., I need to know which color has the highest score, using a calculated field.

       

      For example,

       

      Sr. No.
      Color
      Score
      Output
      1

      Red

      3

      Red
      1Yellow2-
      1Blue2-
      2Red2-
      2Yellow3Yellow
      2Blue2-

       

       

       

      In the above example, Red has the highest score in this serial no. so the calculated field should display "Red"

       

      Is there a way this can be done? Appreciate any help

       

      Sincerely,

      Sahil

        • 1. Re: Calculated Measure
          Tracy Rodgers

          Hi Sahil,

           

          This can be done by creating a calculated field similar to the following:

           

          if window_max(sum(Score))=sum(Score) then max(Color) end

           

          Sr. No., Color and Score should be placed on the rows shelf. Then. place the above calculation on the text shelf. Right click on it and select Edit Table Calculation... Click Advanced from the drop down menu next to Compute Using... In the resulting dialog box place the fields in the following order in the Addressing box: Sr No, Color, Score. Click OK. Then, choose Deepest for at the level and Sr No for Restarting every.

           

          Hope this helps!

           

          -Tracy

          • 2. Re: Calculated Measure
            Sahil Sampat

            Thank you Tracy, it worked