Row-level filters

To create a Row-lever filter, your Data Source must contain a field with the name of the User. It is a great solution when access is already defined in your data. This option uses a Tableau function: USERNAME(). This function returns the username of the current logged-in User.

Again, the best way to understand it is with an example. You can reproduce the tutorial with the Users and Groups in your Tableau Server and the Sample-Superstore Data Source. For this tutorial, I've created three Users in Tableau Server and the following Excel File, which I named User Access:

In the Excel File, we specified that:

  • John Snow has access to all the Regions (do not confuse John Snow, a famous epidemiologist who discovered, in 1854, that Cholera deaths were clustered around the water pumps in London thanks to data visualization, with Jon Snow, who knows nothing)
  • William Playfair only has access to West
  • Charles Minard only has access to Central

Here's the step-by-step guide of how to create a Row-level filter between the data and Tableau Server:

  1. Open Tableau and connect to the Sample-Superstore Excel File.
  2. Add a new Excel connection to the User Access file.
  3. Create a cross-database join between Orders and User Access on the common Region field:

This join duplicates the data by the number of Users, but as you never show multiple users at the same time, it's not a problem.
  1. On a Worksheet, create a new Calculated Field, name it User has access, and write the USERNAME()=[User] calculation. This calculation returns True if the current logged-in User is the same as the User field in the Data Source.

 

  1. Create a new Data Source filter, add the User has access Calculated Field, and keep only the True value. The Data Source filter should look as follows:

  1. You can test the Filter by selecting different Users on Tableau Server with the bottom menu. Here are two examples with the user John Snow, who has access to all regions, and Charles Minard, who only has access to the Central region: 

With this solution, you let the data control the security. It's a great way to handle complex situations because you can create Row-level filters based on multiple fields.

Before Tableau 2018.3, the only drawback was the data duplication: when using an extract, all the duplicated lines must be generated, which makes the Extract gigantic. Since Tableau 2018.3, you can use the multiple table schema when creating an Extract with joins. It drastically decreases the Extract size when using a Row-Level filter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.63