This is a very interesting question that I am currently working on getting some clarification on the exact operation of this within Tableau.
In the meantime, to better understand the issue, what is the use case for the view? It seems as though you are trying to dynamically filter the view based on location when logging in? Is this information not already stored in a user table that could be referenced with row level security.
Hope this helps!
Are you dealing with UTC dates and trying to get them to be in local times? We have had some issues with Salesforce which stores in UTC. I.E if you create an opportunity at 6pm Calif time it shows up in the next day. Salesforce Cloud adjusts for that but if data is brought into Tableau it does not and the opportunity shows up in the next dat.
Have you seen this thread that is recent?
It had some good info. Also we are looking into creating a dashboard extension to handle this it is a good use case I believe.
From the thread
- If you're doing this at client level it would be a bit easier. In other words, if you can assume that a client all use the same timezone, you could set a UTC offset at the client level and store this in the database in a table or in the Tableau report as a parameter or calculated field
- Once you have an offset for the timezone you can use the DATEADD function in Tableau to convert or the dateadd function in your database. Taking into account daylight savings is tricky, and you should do some reading on how to do that within SQL. In MSSQL you might be able to utilize something like
1 of 1 people found this helpful
Thanks for your answer.
Yes, I am using the Row-level security to get the Time Zone of the logged user. I have resolved this issue, but my remaining problem is that I don't know how Tableau Server is getting the Time Zone of every user, and I need to be sure that Tableau will continue using it in the same way in the future because I am implementing a Global Countinuous Integration Framework for my company.
I will try to explain that solucion as clearer as possible:
- Tableau Server saves the user Time Zone in the user_pref table:
- I create a live connection to the PostgreSQL and apply a Row-Level Security for getting only the Time Zone of the current user. For doing this I create a calculated field with the following easy formula: [Name] = USERNAME() and then, apply the filter to get only True values (obviously only 1 row will be filtered)
- Then, I connect my workbook to my regular datasource that contains a DateTime column stored as (UK Time +0):
- I blend both datasources (TabUserDataset = Dataset that contains only the data related to the logged user) using a dummy calculated field that returns "1".
From that point, you can continue in many different ways, but recomend the following two soluctions:
- Create a calculated field with a Case When formula and apply the Dateadd formula to every different Time Zone:
- Connect your Tableau Desktop to an R Server and create an R Script that makes all that work for you (This is my favourite):
And your final result is:
- Opening the Workbook from Spain:
- And opening the same workbook from Australia:
Now I need that someone in Tableau Team give me more information about how Tableau Server is tracking the user Time Zone and what are they plans about this, because I don't want to deliver a framework based in something that Tableau might change in the future.
I hope this solution be helpful for all
Please, see my response to Patrick. I hope my solution can be useful for you.