3 Replies Latest reply on Apr 19, 2018 9:35 PM by lei.chen.0

    Count Measure if Dimension Unique

    andre riley

      Hi, I need help with creating a calculation for sum(Measure) if Dimension is distinct.

       

      For the scenario, imagine that I want to calculate how many unique passengers ride a ride at Disney world. The dimension would be family name such as Johnson Family, Smith Family, Adam Family, etc. The measure would be the count of members of the family ride the ride. Disney rides are awesome though so sometimes families will ride multiple times. I want to count the number of family members that ride the rides if the family is distinct so that we aren't counting people again on the second, third, etc ride.

        • 1. Re: Count Measure if Dimension Unique
          lei.chen.0

          Hello andre,

           

          Please refer to the screenshot.

          image.png

           

           

          Regards

          Lei

          • 2. Re: Count Measure if Dimension Unique
            andre riley

            Thanks Lei,

             

            This is technically correct but I guess I was looking to see if the logic here could be applied to my actual business scenario. I've created a string which combines three strings to create a call ID so calc below is my dimension.

             

            str([part of customer ID])+[employee ID]+str([Call Date])

             

            I created this with the intention of counting the number of unique events that occur on calls with the clients, such as when we sell them something or try to sell them something. I want to record these statistics at the call level, meaning count the number of calls on any day where we attempted or made a sale, rather than count the number of products on any given day we attempted to sell them. The calc comes into play because if they call back on the same day, I only want to count the events on the second call if an event was not attempted on the first. For example if no sale attempt was made on the first but a sale attempt was made on the second, count it but if a sale attempt was made on the first and second, only count the first.

             

            Any idea on how I would do this?

            • 3. Re: Count Measure if Dimension Unique
              lei.chen.0

              Hello andre,

               

              From your descriptions, I think LOD function would probably be necessary for you.

               

              Here are two links for your reference.

               

              Top 15 Tableau LOD Expressions (Practical Examples)

              Overview: Level of Detail Expressions

               

               

              Regards

              Lei