Have you tried filtering on data source?
From Create a User Filter and Secure it for Publishing : "Rather than maintain user filters and special permissions on each published workbook, you can filter a data source, and then publish the data source to make it available as a shared, one-to-many resource for anyone who uses that data."
First, create a calculated field that selects the correct user ( USERNAME() = "username" or something like that).
Then, add this calculated field to the data source filters. In the upper right corner of the data source page, click Add:
Add the calculated field you created as dynamic filter.
Hope this helps!
Thanks for the quick response. I have already used Row level security and used the calculated field [Username] = Username()
I could successfully implement it. Were I had two users "User1" and "User2" in data and two same two users in Tableau server . So that when "User1" logs in he can only see his relevant data and ViceVersa. But I am supposed to used two TABLES "Table1" and "Table2" for User1 and User2. Is there a way to write Customer sql query to select table based on User.
This should be possible. You can use parameters you've created in the workbook in custom SQL statements using the "insert parameter" option on the bottom of your custom SQL box.
haven't tested it, but you could use something like
IF <parameter.user> IS "name1"
ELSEIF <Parameters.user> IS "name2"
For more information visit Connect to a Custom SQL Query
Thanks for the help, I have tried to implement the above query you mentioned. But I am getting an error. I have created a Parameter on User name. which contains user names as Test1 and Test2. Its a string parameter. I have inserted the same in the query but it gives an error. May be the syntax I have written must be wrong. Here is the screenshot.
I'm no expert on SQL, perhaps the IF statement is not supported.
You could try a CASE statement?
WHEN <parameter> is "test1"
WHEN <parameter> is "test2"
or something like that?
Perhaps custom queries aren't supported by your ODBC connection...