1 Reply Latest reply on Jun 4, 2017 7:23 AM by Yuriy Fal

    Create a string + value list in tooltip

    Julius Uusikylä

      Hi!

       

      I'd like to create a string list with string + value and would need some help with the caluclated fields syntax, i think.

       

      I followed along the article Create a String List in Tooltip, which worked OK out for me: Creating a String List to Display in a Tooltip | Tableau Software

      Using this example , how would you make the string list show "City" AND "Sales" for each city in the list? This tutorial shows you how to make a list with only city names (strings) without any values for each City, right?

       

      I think the key is to add Sum of Sales in the "City List" calculated field. This is entered in Step 3, point 2:

       

      '-' + ATTR([City (string)]) + '

      ' + PREVIOUS_VALUE('')

       

       

      which gives the names of cities with a "-' before each city, on separate lines. removing '-' in start removes a line in front of each name in the list (i removed this in my case below). But how do i add the Sum of sales of each City into the list here? I tried for example

       

      '-' + ATTR([City (string)]) + SUM([Sales]) + '

      ' + PREVIOUS_VALUE('')

       

      which gave syntax error message and i got stuck.

       

      I'm not so used to the syntax in tableau calculations, but it does not seem too difficult.

       

      My case:

      I have some elections data, where i have the election results for each political party in each muncipality in Finland (muncipality replacing "State" in the string list example). Muncipalities are shown as different circles with coordinates, and i want the tooltip on each muncipality to show the number of seats each party (instead of "City" in example) got. The list in tooltip would look like this:

       

      Seats in muncipality board:

      PARTY A   12

      PARTY B   9

      PARTY C   4

       

      etc...

       

      With the tutorial i got so far as to show the parties that got seats in a list (as in PARTY A PARTY B PARTY C on separate lines, without the numebr of seats) in a tooltip:

       

      Screen Shot 2017-05-31 at 09.56.30.png

       

      How to get the number of seats in there?

       

      Julius