2 Replies Latest reply on Oct 9, 2012 11:34 AM by T M

    Map two different columns from two different Tables

    T M

      I have two tables – X and Y

      • X has column “Name” with values “A”,”B”,”C”
      • Y has column “Campaignid” with values “D”,”E”,”F”.

       

      I want to map these two column values.. i.e

      1. X.Name[A]= Y.Campaignid[D] so that I could relate the measures in each of these tables.

       

      I tried to edit aliases of Campaignid values to match Name and then create a join, but unfortunately while joining two column values Tableau considers the original values of the column and not Aliases. Hence, is giving me Null result set.

       

      Can someone please help me resolve this issue? Any help would be much appreciated. Many thanks in advance!

        • 1. Re: Map two different columns from two different Tables
          Robin Kennedy

          TM,

           

          I take it your tables are being joined within one data source? If there is no way that you can change the data at the source or create a new view in the database which corrects the CampaignID and connect to that instead, then one possibility is to write some custom SQL in the data source connection.

           

          Replace [Campaignid] in the custom SQL with something like

           

          CASE [Campaignid]

          WHEN 'D' THEN 'A'

          WHEN 'E' THEN 'B'

          ...

          ELSE [Campaignid]

          END

           

          This may have an adverse effect of slowing down your viz as the query isn't optimised any more. If this happens try working from a Tableau Data Extract instead of a live connection.

          • 2. Re: Map two different columns from two different Tables
            T M

            Thanks Robin!

             

            Unfortunately, I cannot make changes at the source/DB level.

             

            I just have about 10 values that need to be mapped and I would want to keep the control at frontend level in case they change. I created a calculated field to have the Case statement with the mapping as suggested above and used that field to join the tables and it works well.

             

            Thanks again! Appreciate the help!