7 Replies Latest reply on Jun 26, 2018 11:47 AM by produktion.wiwo

    Calculated field: Return string value from column on the same row

    produktion.wiwo

      Hey everyone!

      I am absolutely new to Tableau and I must already bother you with a question or two. It’s (probably) very basic one, but I just started learning. Any help would be greatly appreciated!

      Here's a (very simplified) data-sample…

       

      CompanyRankCountry
      CompanyA1USA
      CompanyB2USA
      CompanyC3USA
      CompanyA1UK
      CompanyX2UK
      CompanyYnullUK

       

      I created a map from the country column and want to show the first ranked company on a tooltip (on mouseover something like “Rank 1: <company>”). So basically I want to create a calculated field which takes all rows with a specific country (country is a string), looks up the rank (an integer) in the ranking-column and returns the corresponding name of the company (also a string) to put it on a tooltip. I guess, the LOOKUP()-function is the way to go, but it doesn’t seem to work on strings?

      The int-attribute (ranking) is unique per country, so there are no duplicate companies per country. The original data-sample is waaaaay bigger than the sample, so e.g. hardcoding country-names isn’t an option.

      Is it possible to return the country-string? Any help would be awesome!

       

      Best,

      Sebastian