3 Replies Latest reply on Oct 16, 2012 1:49 PM by Mark Holtz

    Help with count

    Harley Ellenberger

      In the attached workbook, what's the syntax for a calculated field that will count the number of markets where ADVANTAGE > 0

        • 1. Re: Help with count
          Mark Holtz

          Hi Harley,

           

          You can create a calculated field with this syntax:

          IF [ADVANTAGE] > 0

          THEN 1

          ELSE 0

          END

          • 2. Re: Help with count
            Harley Ellenberger

            Thanks, but that's not giving me the desired result.

             

            Basically I need a count of the number of markets where the advantage is greater than zero.  In my packaged workbook, the calculated field would return 11, as there are 11 markets with an advantage > 0.

             

            I'm then going to create another calculated field to give me the number of markets where the advantage is less than zero.  I then want to plot those 2 numbers.

            • 3. Re: Help with count
              Mark Holtz

              Ah, I see.

               

              You are asking to aggregate the underlying data to the market level, make the assessment of [Advantage], then SUM the results of that assessment...  As far as I know, you'd have to use a table calculation (WINDOW_SUM) to get to the Market-level data, since your underlying data exists at a level "below" that.

               

              Then, to further aggregate (count) the number of markets satisfying some measure-based criteria is something I'm not sure how to accomplish with Tableau.

               

              Could you create a secondary data source which aggregates the data to the market level first?  That'd make this a breeze using the logic I described before.  Otherwise, you'll have to hold out for one of the Tableau superstars to join the conversation.

               

              Sorry I couldn't be more helpful...