4 Replies Latest reply on Sep 27, 2016 1:43 PM by Abhishikt Dawson

    Help on a calculated field

    Abhishikt Dawson

      Hi All,

       

      I am working on a dashboard and came across with a unique requirement and request any expertise on this. I have a set of data with 8 columns with "Yes/No" data in it. There are 11915 rows of data and I am looking for a calculated field which gives me the percentage of all columns which have at least one "yes". in this case it would be it would be 9565 records which have at least 1 "Yes" and the percentage to overall is 80%.

       

      Any help on this is really appreciated.

       

      Thanks,

        • 1. Re: Help on a calculated field
          Joe Oppelt

          if [a]='Yes' or [b] = 'Yes' or [c] = 'Yes' ... THEN 1 else 0 END

           

          That will get evaluated for each row.

           

          { FIXED : COUNT([whatever field]) }

           

          This will give you the count of rows in your data source (no matter what filters are used on your sheet.  This assumes V9.0 or higher of Tableau.)

           

          SUM([Calc-in-the-first-line-of-this-reply])

           

          This will give you the sum of rows that have at least one 'Yes'

           

          The SUM calc divided by the FIXED calc will give you your percentage.

          • 2. Re: Help on a calculated field
            Shawn Wallwork

            I interpreted this a wee bit different than Joe -- he's probably right, but since I created a workbook before I saw his response, I'll attach it anyway. It's 10.0 and uses the new pivot option to reshape your data. Here's what you get:

             

            Of course we have no idea what version of Tableau you are working on. Or what the rest of your situation really is. But take a look at the attached 10.0 workbook and see what you think.

             

            --Shawn

            • 3. Re: Help on a calculated field
              Abhishikt Dawson

              Thank you for the reply!

               

              I am working on tableau 9.2 version, I think I forgot to mention that my data that is currently there in the excel sheet is taken as a pivot data in tableau.

              So i need a work around to this assuming these 8 column of data are actually in a pivot.

               

              Thanks

              • 4. Re: Help on a calculated field
                Abhishikt Dawson

                Thank you for the reply!

                 

                I am working on tableau 9.2 version, I think I forgot to mention that my data that is currently there in the excel sheet is taken as a pivot data in tableau.

                So i need a work around to this assuming these 8 column of data are actually in a pivot.

                 

                Thanks