5 Replies Latest reply on Nov 29, 2016 12:53 PM by Walt Reed

    Tooltip Shows Asterisk When Multiple Values Present

    Jon Townsend

      Hi Tableau, I am having a problem where my tooltip populates with an asterisk ( * ) when there are multiple values present for a single zip code on my map. I know if have seen a way to make it show you just the top result in that zip code, but I cannot find that page anymore.

       

      I believe it's a table calc, but if anyone can help, it would be greatly appreciated. See the screenshot below for clarification. (Unfortunately I can't share an export due to privacy restrictions). Thank you in advance!

       

      Tableau Asterick Problem on Maps.PNG

        • 1. Re: Tooltip Shows Asterisk When Multiple Values Present
          Walt Reed

          Hey Jon,

          I read that you want to show only the top salesperson per zip. If this is correct, try the following:

           

          Create a calculated field which takes the dealer name with highest sales for each zip, then put this field on Label:

          IF { FIXED [Dealer Billing Zip],[Dealer Name]:SUM([Dealer Sales])}={ FIXED [Dealer Billing Zip]:MAX({ FIXED [Dealer Billing Zip],[Dealer Name]:SUM([Dealer Sales])})} THEN [Dealer Name] ELSE "" END

           

          Then create another TF calculated field and add to filter:

          { FIXED [Dealer Billing Zip],[Dealer Name]:SUM([Dealer Sales])}={ FIXED [Dealer Billing Zip]:MAX({ FIXED [Dealer Billing Zip],[Dealer Name]:SUM([Dealer Sales])})}

           

          Cheers,

          Walt

          1 of 1 people found this helpful
          • 2. Re: Tooltip Shows Asterisk When Multiple Values Present
            Jon Townsend

            That is perfect. That does make it show the top dealer in that zip code. Thank you.

             

            Do you know if there is any way to show the name of the top dealer in that zip code, but also show total sales for all dealers in that zip code?

            • 3. Re: Tooltip Shows Asterisk When Multiple Values Present
              Walt Reed

              Sure. You could do {FIXED [Dealer Billing Zip]:SUM(Sales)}

               

              Walt

              • 4. Re: Tooltip Shows Asterisk When Multiple Values Present
                Jonathan Drummey

                Hi Walt,

                 

                Here's a a couple of optimizations, I'm writing this because LOD expressions are so fantastic that they can look like the hammer for every nail (and screw) and sometimes they aren't needed. I've done this multiple times over the years with both LOD expressions and table calculations and built views (and made suggestions to others) that were over-complicated and harder to explain and maintain, and it's only through others pointing out what I was doing that I learned in the spirit of sharing hard-earned wisdom here are some suggestions.

                 

                Since the viz level of detail (vizLOD) is at the level of Dealer Billing Zip there's no need for any LOD expressions to be using {FIXED [Dealer Billing Zip] : ...}, this can cause unnecessary subqueries that can impact performance. In addition for new Tableau users FIXED can be confusing because the FIXED LODs are computed before regular dimension filters are applied, so to make dimension filters apply before the FIXED LOD is computed we need to learn and remember to use a context filter.

                 

                Here's how I'd do the Dealer w/Max Sales for the tooltip, this assumes that there is *more than 1 record/row* per dealer & zip, if that's not the case then there's an even simpler calculation further below.

                 

                Dealer w/Max Sales (more than 1 row per dealer & zip)

                 

                IF ROUND({INCLUDE [Dealer Name] : SUM([Sales])},2) = ROUND({INCLUDE : MAX({INCLUDE [Dealer Name] : SUM([Sales])})},2) THEN

                   [Dealer Name]

                ELSE

                   ''

                END

                 

                To deal with the situation where there might be ties, add this to the view with the MIN() aggregation to get the first one alphabetically.

                 

                There are five things going on here that are different from the FIXED calculation that was suggested:

                1) Because the vizLOD is already at Dealer Billing Zip we don't need to specify it in the INCLUDE expressions.

                2) Using INCLUDE instead of FIXED means that we avoid the order of operations problem around filtering.

                3) Even though INCLUDE & EXCLUDE calcs must be aggregated in the view, they still return record-level results.

                4) The {INCLUDE : structure with no dimension declaration is telling Tableau to use the existing vizLOD in the calculation.

                5) The ROUND() is necessary because LOD expressions are not guaranteed to return the same results (Tableau & data sources use floating point math that could end up with one expression returning 20.000000000 and another returning 19.9999999999, using ROUND() gets away from that).

                 

                Dealer w/Max Sales (1 record per dealer & zip)

                 

                If the level of detail of the data is at the Dealer & Zip code level (i.e. one row per dealer & zip code) then the calc could be even simpler:

                 

                IF ROUND([Sales],2) = ROUND({INCLUDE : MAX([Sales]),2) THEN

                   [Dealer Name]

                ELSE

                   ''

                END

                 

                 

                Total sales for zip code tooltip:

                 

                Just use SUM(Sales) for the tooltip, the {FIXED [Dealer Billing Zip]: SUM([Sales])} is unnecessary because the vizLOD is already at Dealer Billing Zip.

                 

                Jonathan

                • 5. Re: Tooltip Shows Asterisk When Multiple Values Present
                  Walt Reed

                  Hey Jonathan,

                  Thanks so much for the thoughtful and detailed explanation--I'm always looking to learn how to do things better. I've been practicing LOD expressions a lot lately, so I'm sure I've been using them unnecessarily

                   

                  Walt

                   

                  PS--I love the Datablick blog--keep up the excellent work.