6 Replies Latest reply on Dec 5, 2016 10:10 AM by Joe Oppelt

    Count of positive growth?

    Niranjan Banarjee

      Hi,

       

      Whats the best way to calculate the count of positive growth and count of negative growth in the entire map/ table.

       

        • 1. Re: Count of positive growth?
          Joe Oppelt

          window_sum( IF [your growth field here] < 0 THEN 1 ELSE 0 END )

           

          You'll have to know what type of field your [growth field] is.  If it's already and aggregate field, then the above should work.  If it's a row-level measure, you'll have to make it an aggregate first, such as SUM( [your growth field] ).

          • 2. Re: Count of positive growth?
            Joe Oppelt

            And that's just one way of doing it.  There are multiple ways to get that count, and some of them depend on how your data looks and how it's arranged on your sheet.

            • 3. Re: Count of positive growth?
              Niranjan Banarjee

              Hi Joe,

               

              I have the growth at Row level.And trying to use the below formula its showing error.Can you help.

               

              window_sum( IF (SUM([Growth]) < 0 THEN 1 ELSE 0 END ))

               

              window_sum( IF AVG([Growth]) < 0 THEN 1 ELSE 0 END )

               

              Both the above formulae showing errors.

               

              Growth is calculated field for me.

              • 4. Re: Count of positive growth?
                Joe Oppelt

                Post a sample workbook.  I can help if I have something concrete to work with.

                 

                Specify the version of Tableau you are using so I can modify it with the same version you have.

                • 5. Re: Count of positive growth?
                  Niranjan Banarjee

                  Hi Joe,

                   

                  Please find attached the sample workbook with the requirements.

                   

                  Kindly help.

                  • 6. Re: Count of positive growth?
                    Joe Oppelt

                    (Note to self:  V 9.3 workbook)

                     

                    See attached.  I put the values for the calcs in tooltips so you can see them.  These are table calcs, so I had to specify "Compute Using" and "At the level" settings to get Tableau to look at all the individual rows (customers) being evaluated, but not count up all the actual rows (so that we just get counts of countries on the sheet.)

                     

                    Also look at Sheet 2.  It's a duplicate of your sheet, but I changed the way we're differentiating red from green.  Your way is fine, but I just wanted to show you that.

                     

                    And finally, look at the [Growth] calc.  I wrapped it in the ZN() function.  This puts a zero value when there is null.  I just did that to make sure I was matching the number of marks that Tableau was evaluating.  (The null values were not getting counted in my calcs.)

                     

                    I don't understand, though, what constitutes a top-30 customer.  I just went with the filters that you already have.  I am guessing that you have certain customers that you want in/out.  I notice that if I select ALL for your filter, 8 more countries (dots) show up on the map.  So there must be 8 countries that your top-30 don't operate in.  Let's talk about this part more.