2 Replies Latest reply on Oct 31, 2017 12:33 PM by Patrick A Van Der Hyde

    Calculating Retention from two sources

    Varun Dey


      I'm combing two data sources, the first data source is my retention numbers and second data source is my install numbers. I want to calculate retention which will be retention/installs, i tried creating a calculated field for the same but seems not working. Please note retention will vary from day0 to dayN. Please refer the attached tableau workbook for more information. Any help will be deeply appreciated.



      Taking the example of '2017-09-01', The number of installs on '2017-09-01' is 4, the day 1 retention for the same date will be 4/4 ie, 100%, day 2 retention for the same will 0% and so on.

      My objective here is to visualize retention % as a heat map shown below.


        • 1. Re: Calculating Retention from two sources

          Hello Varun Dey,


          I have attached the workbook, .twbx, version 10.3.

          Let me know if you need further assistance



          Lénaïc RIÉDINGER, Global Community Engineer Tableau

          Tableau Community Forums | Knowledge Base

          If you see a Helpful or Correct response, please mark it thanks to the buttons below the targeted post!

          1 of 1 people found this helpful
          • 2. Re: Calculating Retention from two sources
            Patrick A Van Der Hyde

            Hello Varun,


            I have updated the workbook to supply a calculation for the percent of installs.



            First, I created a LOD (Level of Detail) calculation for the installs per retention day:  {include [install_date],[Retention Days]:countd([User Id])} and then  creatd a calculation to get a consistent number for Install per day as another LOD calc: {exclude [Retention Days]:countd([user_id (Custom SQL Query)])}


            Then I have created the calculation that divides the Retention user id count for each day by the number of installs for that date.  This is in the form of a Table Calculation using Lookup() because we want a null to to be created for the view that can be changed to a zero.  This was the part that seems incorrect to me because I'm not sure how you have 4 installs and then on a later day 2 and then 0 and then 2 again??


            See this post for more information about changing nulls to zero. Displaying 0 in null fields


            Finally, I have the result wrapped in a zn() command to flip the nulls to zeros.


            I hope that helps but if you need more assistance, let us know because I was unclear from the question how to handle the math.