Restricting Views with the USERNAME Formula

Do you have a dashboard that you only want certain users to view their own items when they open the dashboard? Use the USERNAME formula! For more information on other User Functions, refer to this Tableau website here.


In this example I have a very basic dataset with Username in a column of the data. Additionally, I am using my username in the data set for testing purposes. This is always a good practice if you want to test the functionality of the filters. If the username is not in your dataset, you can always join another data set to your original data in the Datasource tab of your Tableau workbook.



How do you find your Username?


To find your username, create a Calculated Field with USERNAME() in it.



Then place this in a blank worksheet. My email is my username in my Tableau Public workbook. I ensured I entered this in the Excel spreadsheet for you to see how this example works.



How do you set up your worksheet for the UserName Formula?


For this example in Tableau, I set up the worksheet as follows;


I need to create a Calculated Field with the following formula;


Username Filter

USERNAME()=[Username]


Then I add this filter to the Filters card.

Check the True box on the Username Filter pop-up menu.

Now in the canvas, I only see the results for the items that list my username.



You can add to this filter if you only want your users to see specific reports and if you want a delegate to view those items as well.

Your spreadsheet will need to be set up as follows;



You will need to change your Username Filter to the following;


USERNAME()=[Username]

OR USERNAME()=[Delegate]


Now with this filtered changed, I can see the data for Test 2.






54 views0 comments