This is Part 2 of the user filter blog on using an external table with usernames and groups to create user filters based on calculated fields.

Please refer to Part 1 written by Laura Scavino for a quick introduction on adding user filters by creating username sets.

A big thanks goes to tableau Server Guru Jonathan MacDonald for this days server training!

 

1. Username Table

Creating and updating your username sets might become a repetitive process with large amounts of users and/or when users are added or removed.

Below is a quick way to join an external table to your data source to define your user filters.

First we join our external table containing: group, name (display name in Tableau Server) and username to our existing data set, extracted from Tableau Server.

 

2. Filter to Username

In order to filter directly to the Tableau Server username we create a Boolean statement using a calculated field:

CONTAINS([Usernames], “,”+USERNAME()+”,”)  #Note that we had to add the comma’s as a string to match our username table format.

 

Now we can drag the calculated field onto the filter, select true and voila, username filter done.

 

3. Filter to Group

We can likewise create a Boolean statement using a calculated field check to check what group the user belongs to.

In our case we are looking at other dataschoolers and I divided the statement into the groups currently here using the ISMEMBEROF function, which matches to a string (cannot use a dimension), and therefore we need a second part to match [DS] to the string:

(Please note that it is possible to reduce the calculation length by duplicating the username table data source and transposing it but for the sake of this example we stick to one username table).

The same as before, we can now add this onto the filter shelve and bellissimo!

 

To recap: Laura and I showed you two different ways to produce the same Dashboard with the same user permissions. Either by creating user filter sets or by joining a username table and create calculated fields.

If you look closely at the images throughout this post, you can tell that Laura overtook me in the ‘blog race’ whilst I was writing this post…. Don’t you worry Laura, I will see you at the finish line!

That’s it for now, feel free to contact me about any of the content on Linkedin or Twitter @RobbinVernooij