2 Replies Latest reply on Aug 1, 2016 11:10 PM by Justin Maar Branched from an earlier discussion.

    Re: How to Divide the sum of one measure by another measure

    Justin Maar

      Hi Josh

       

      I am a Tableau newbie trying to add my first calculated field.  I am trying to determine an offer accept rate and add that to a text table which already has columns displaying the number of accepts and the number of declines. 

       

      I think it's probably relevant to mention that the accepts and declines were both calculated using a the COUNT function from an excel workbook that uses a date to signify that there was an accept or decline (i.e. if I accepted the terms of a contract- this would be displayed in an excel column as July 30th, 2016.

       

      The error I am receiving is "can't divide string value by string value" (which exposes how novice I am because I don't grasp the concept of strings versus other data types despite browsing the community forums). I can get the first part of the formula to work (COUNT([Accept])+COUNT([Decline])), but once I attempt to calculate the ratio with COUNT([Accept])/([Accept])+COUNT([Decline])) I receive the aforementioned error.

       

      I suspect this has something to do with number formats, but my excel-wired brain can't figure out why I can't divide the count of 1 number of instances by another.

       

      Do you have a solution or advice?

       

      Thanks in advance

       

      Justin 

        • 1. Re: How to Divide the sum of one measure by another measure
          Carl Slifer

          Hi Justin,

           

          Can you provide a sample of raw data? This way I can attempt to replicate the issue with your data formatting. Currently however this what you have for a calculation?

          COUNT([Accept])/([Accept])+COUNT([Decline]))

           

          COUNT([Accept])/(COUNT([Accept])+COUNT([Decline]))

          I think the above might fix part of the issue. Previous we had mismatching aggregations. One that was an aggregate (anything with count, sum, etc) and a non aggregate. Accept sounds like it would just be a bit of information not an aggregation.

           

          Further count may not work how you intend it to work depending on your data. Count checks if something is there it would count 1 if it saw 1 and count 1 if it saw 0. You may need to use SUM() if this is how your data looks.

           

          Provide a sample and I'll look into it more.

           

          Best Regards,

          Carl Slifer

          InterWorks

          • 2. Re: How to Divide the sum of one measure by another measure
            Justin Maar

            Thanks Carl! It was a simple issue of me forgetting a function.  I think it's wonderful that you are providing this type of advice (I used to do the same for excel issues- and I am late to the Tableau world!).

             

            Best,

             

            Justin