2 Replies Latest reply on Nov 7, 2013 6:13 AM by David Goldstone

    SQL Custom connections

    David Goldstone



      I am hitting an azure dab with a vast amount rows. The columns are PersonID, name, ParentOrgAddress1, ParentOrgAddress2, ParentOrgAddress3, OrgID1, OrgID1Name, OrgID2, OrgID2Name, OrgID3, OrgID3Name. This is replicated through to Org5.


      I am trying to pull all Persons that appear in the relevant OrgIDName with a particular OrgID number. i.e A person will work in OrgID1 that wont work in OrgID2 and so on.  I have used this Where clause in SSMS to pull and validate the data:


      SELECT [PersonID], [Name]


      FROM dbo.[Physicians]

      where [OrgID1] = '180088'

      or [OrgID2] = '180088'

      or [OrgID3] = '180088'

      or [OrgID4] = '180088'

      or [OrgID5] = '180088'


      The results come back as I what I think is correct. The problem occurs when I create a custom SQL connection in tableau and start dropping the Name fields with OgIDs into the column shelf or rows, it will only work when I have OrgID1 on the shelf. When I add OrgID2 it loses all the names and wont work.

      How can I successfully display all names in Tableau where they match the corresponding OrgID whether it be OrgID1,2,3,4 or 5?

      As an alternative, I have even tried filtering in tableau on all the OrgId columns on a clean SQL connection and the result is the same.

        • 1. Re: SQL Custom connections
          Russell Christopher

          David -

          Would you mind posting a small excel spreadsheet which contains the absolute minimum number of "fake" columns and rows to illustrate the issue? It's a little difficult to understand what you're trying to do and what isn't working for you.


          A combination of a spreadsheet and an example of "the way you think it should behave" vs. the "way it is behaving" would help folks answer your question.


          FYI, it's also not necessary for you to use Custom SQL to do this filtering work. Take a look at the "Context Filter" help topic - it will allow you to do the same thing. You could create a simple expression which duplicates your logic above and then add that as a context filter so that only "true" rows come back to Tableau.

          • 2. Re: SQL Custom connections
            David Goldstone

            Hi Russell


            Thank you for your response. I shall try the context filter and see if this works. If I am still having a problem I will post the further detail as your suggested.


            The context filter may very well work.