1 Reply Latest reply on Oct 23, 2018 4:00 AM by Ritesh Bisht

    Different queries  for different users

    Bogdanovici Robert

      Hello!

      Is it possible to use a different query if one user is connected and another if other user is connected? I am afraid to extract all data and then put a filter based on user because there will be millions of rows. Thanks!

        • 1. Re: Different queries  for different users
          Ritesh Bisht

          Hi Robert ,

           

          It depends ,

           

          If your data is having user name then it is easier for you

           

          Username              Location                    Currency

          ribisht                      INDIA                         Rupees

          phemchan                  US                          Dollar

          1. Connect to Data Table “d”
          2. INNER JOIN Security Table “s” ON “d”.security_key = “s”.security_key
          3. Create a Calculated Field in Tableau using [“s”.tableau_username] = USERNAME()
          4. Put the Calculated Field on as a Data Source Filter, set to True
          5. Publish the Data Source to Tableau Server
          6. All user workbooks must connect to the Published Data Source. Now the data source will be filtered to the logged in user, and they cannot get around the data security model, owing to the data source filter.

          You can represent this in SQL like the following (although VizQL will produce whatever complex queries it needs, this is the basic form):

          Details below,

          https://tableauandbehold.com/2016/03/07/how-to-set-up-your-database-for-row-level-security-in-tableau/

           

          Please mark the answer as CORRECT and HELPFUL if it really helps you so that it can help others as well