1 Reply Latest reply on Oct 18, 2018 7:37 PM by Yuriy Fal

    How To Create Site Repeat Visits

    Samrina Shah



      I am trying to create a calculated field that calculates "Site Repeat Visits".


      A Site Repeat Visit is:


      If a person has already had a "Site First Visit", the [Radius] = "In Zone" and 45 minutes has gone by since their previous ping.


      If a person is pinged "In Zone" on a previous day and "In Zone" on a following day, they will be considered a "Repeat Visitor" instead of a "First Time Visit"


      My thoughts on potential solutions:


      1) Create a calculated field in Tableau that has the time difference between the previous ping.


      [Diff Between Timestamps]

      ATTR([Timestamp])  - LOOKUP(ATTR([Timestamp]),-1)


      2) Create a calculated field for Site Repeat Visit


      [Site Repeat Visit]

      IF [Diff Between Timestamps] >=2700

      AND ATTR([Radius]) = "In Zone"

      THEN "Site Repeat Visit"

      ELSEIF ATTR([Is Site First Visit?]) = 1 THEN ""





      1) Since it is a table calculation how do I make it into a bar chart. Where Date is in columns and Site Repeat Visit is in rows.


      2) Repeat Visit and First Visit are being counted as 1 at the same time and that shouldn't happen.



      I have attached a workbook.

      I appreciate any help.


        • 1. Re: How To Create Site Repeat Visits
          Yuriy Fal

          Hi Samrina,


          Your Second Issue first:


          The [Site Repeat Visit Count] is a Nested Table Calculation,

          so the proper Adressing & Partitioning is required

          for it to work as expected (to get correct results).


          This particular calculation should be partitioned by [Person]

          (ie calculated for each Person distinctly).


          Please check the Edit Table Calculation dialog

          for each Table Calc on my workout (table) view.



          Next onto your First Issue:


          For counting (grouping by) the results of Table Calculations

          using (other) Table Calculations as Bins (group by values),

          one could apply a special technique using some properties

          of the RANK family of Table Calculations.


          For that I wrote two similar-looking calculations --

          first one to do the counting, the other one for the filter

          (to left only one Mark for each Bin on a view).


          Since we wouldn't interested in counting other (non-repeating) Site Visits --

          only the repeated ones should be taken into account --

          the Bin 0 has to be filtered out, too, hence the second Table Calc filter.


          Please find the attached with both views.

          Hope it could help a bit, though the solution

          may look rather complicated.