User functions in Tableau: Use server attributes to control your workbook.
sdasd
- The user dropdown at the bottom right of Tableau Desktop lets you simulate the dashboard as specific users or groups pulled live from Tableau Online, so you can test conditional logic before publishing.
- FULLNAME, USERDOMAIN and USERNAME need no data input and behave like a parameter fed dynamically by the server with the current user's details — useful for personalised welcome messages.
- ISMEMBEROF requires a string literal for the group name (not a calculation), and returns false if it can't reach the server, which matters when using it for security.
- Username and full name are often different — on Tableau Online the username is typically your email, whereas full name is your display name.
- The strongest use case is ISMEMBEROF with group membership to drive conditional calculations for different business units, rather than targeting named individuals.
- What user functions do0:00
- Simulating users and groups0:44
- Where groups come from in Tableau Online1:36
- FULLNAME function2:13
- USERDOMAIN function4:05
- USERNAME function5:53
- Simulating groups vs individuals6:52
- ISMEMBEROF and group checks8:33
- ISFULLNAME and ISUSERNAME11:51
- Best use case: conditional calculations by team13:48
0:00Hey, it's Tim here. Today I'm going to be
0:01touching on a set of functions that I don't
0:03think are used
0:04enough. These are actually the user
0:06functions. Essentially the user functions
0:07allow you to check
0:09whether the current user has certain
0:11attributes that are acquired from Tableau
0:13Server or Tableau
0:14Online. Let's get stuck in and then maybe
0:16you'll see exactly what I'm talking about.
0:18I'm going to
0:18go ahead and connect to Sample Superstore
0:21Sales, the standard data source of Tableau.
0:24Every single
0:24demo uses this data source. What you can
0:27see here is just a standard view and I'm
0:29not actually going
0:30to build anything. I'm just going to start
0:32off with this very simple view because I
0:34actually
0:34want to show you these functions up front.
0:36The other thing I want to just call out is
0:38that
0:38there's a little section at the very bottom
0:40right. If you just see here, it actually
0:42has my name.
0:43Actually a lot of people think that this is
0:46simply Tableau being aware of who they are
0:48and just
0:49logging in. But not many people actually
0:50think to do this, which is to click on this
0:52little drop down
0:53and see that you can actually simulate
0:56usage of your dashboard given specific
0:58users. Now you can
0:59see that I'm on here twice. That's
1:00essentially because I'm connected to my dev
1:02instance. So this
1:03Tim Neguenna here at the top is actually my
1:06viewer instance of myself using my personal
1:09email.
1:10And the second one is my Server Admin
1:13instance of myself using a slightly more
1:17high level access to
1:18the whole entire Tableau Online site. You
1:20can also see that I've got two groups, one
1:22called a
1:22new group, which I literally just created,
1:24and another one called Data Rockstar. Okay,
1:27so there's
1:27only two people here and then they've also
1:29got this group here called All Users.
1:30Essentially,
1:31it shows you some of the information that
1:33you can actually get from Tableau Online.
1:35Let me show you
1:36where this actually comes from. So let's go
1:38back to Tableau Online and you'll see that
1:40this is my
1:40Tableau Online instance. If I just go down
1:42here to the left hand side, if you're
1:43wondering where I am,
1:45I've just gone over here to Groups. And if
1:47I click on the Groups section here, you'll
1:49see that I have
1:49those same groups. So these groups are
1:52being dynamically pulled by Tableau Desktop
1:54into the
1:54Tableau Desktop environment, and then it's
1:57able to use that as context for my visual
1:58izations. Okay,
2:00so this is something that you can sort of
2:01cleverly use because the fact that you can
2:03check if someone
2:04is part of a group means you can actually
2:06use this to do things like conditional
2:08calculations,
2:09depending on which group someone is part of
2:11. So let's just dig into some of these
2:13functions.
2:13That's what this video is about. So let's
2:15go ahead and create a calculated field. And
2:18we can
2:18just start using them, there's sort of no
2:19prerequisite, they don't even need you to
2:21put
2:21anything inside of the calculation window
2:23for them to work. I'm just going to make
2:25the text super
2:26large. So you can see that. And if I go to
2:27this little drop down here, you'll see that
2:29you get a
2:30list of groups that are basically where the
2:32functions live. And if you go to the user
2:34functions, you'll see that we get these
2:37nice sort of I think how many is it six
2:39functions here that
2:40we can use. And these are all essentially
2:42checking information on Tableau Server. So
2:45let's try each
2:45of them one by one and see what they do. I
2:47'm just going to click inside of the
2:49calculation window
2:50and double click full name. And I'm just
2:52going to call this full name. So let's just
2:54see what that
2:55does. So let's hit apply. And now that I've
2:58hit apply, you'll see that it actually
3:00creates this
3:01calculated field over here. Because of the
3:03way this works, it's not actually using
3:06anything from
3:06the data set. So that's why you'll see that
3:09it's actually sort of not part of our
3:11orders or returns
3:12table that's actually created in this. I
3:14call it sort of the limbo actually, down
3:16here. So
3:17everything here that doesn't sort of live
3:19as a sort of indent from these other tables
3:22essentially
3:23is being created in a space that isn't
3:24inside of those tables. It's just slightly
3:27hard to understand.
3:28If you check out my data model video, I do
3:29actually go into that in more detail. So
3:31let's
3:32drag full name into the view. And you can
3:33see that if I drag the full name into view,
3:35you can see that
3:36the full name is Tim Lebama. Thank you. So
3:38there we go. That's the function pretty
3:40much in a nutshell.
3:42Now, because it's this literally returning
3:43this, it means that it applies this almost
3:45a bit like
3:46a parameter. So if I was to actually get
3:48some sort of aggregate values into this
3:50view, and just drop
3:51it in, it essentially just applies this
3:53full name to the entire workbook. It's like
3:56a parameter
3:57that's being dynamically fed by the Tableau
3:59server and into that sort of parameter, it
4:01's putting your
4:02user details. Okay. Now, what I can also do
4:05is I can also check what domain I'm part of
4:07. Okay, so
4:08let's close this function. And I'm just
4:10going to duplicate this because again, I'm
4:12super lazy.
4:13If I go to edit, and I just type in domain,
4:16and we can just highlight this, go back to
4:19my user
4:19functions, and select user domain, you'll
4:22see that it replaces that. So you can just
4:24see, that's all
4:25I need to type. This is a valid
4:27calculations, you can see that just here.
4:29It's saying that it's
4:31valid. So I don't need to do anything else
4:33for this to sort of work. Okay, so let's,
4:35let's just
4:36get out of this and just hit apply. And you
4:39can see the user domain has been created.
4:41So it's sort
4:42of over there. And if I drag that into the
4:44view, you'll put that in front. And you'll
4:46see the
4:47domain is external. And this is because
4:49essentially, I'm not actually on Tableau
4:50Online, I'm actually
4:51not using a Windows domain. In this
4:53particular case, that's what this actually
4:55is. Now, to just
4:56explain this in more detail, in some
4:58organizations, you can actually create
5:00something called a Windows
5:01domain. And the domain basically just
5:03explains to you, infrastructure and
5:05technology, what part of
5:07the business you work in. So a typical
5:09example, if you're a global organization,
5:11you might be in the
5:12EMEA domain. And that means all the
5:14technology and infrastructure you use is
5:16part of the EMEA
5:17infrastructure. Okay, this allows IT
5:19professionals to essentially put people
5:21into different groups
5:22for various sort of reasons I won't go into
5:24. But that's essentially what it is. And you
5:26might
5:27actually choose to run certain conditions
5:30based on whether someone is part of one
5:32domain, or another
5:33domain. So that's just something to be
5:35aware of, if that makes sense. A good
5:36example here might be,
5:37let's say you have different currencies in
5:39different domains, and actually matches up
5:41one
5:41to one, you could actually use this to do
5:43some little currency conversion, using some
5:45maybe
5:46dynamic fields coming from other data sets.
5:48Okay, so that's a really sort of nice, nice
5:50to have a
5:51little feature there. And the other thing I
5:53can actually pull out is the username. So
5:54let's
5:55duplicate this out. And let's duplicate
5:57this. And then let's edit that again. And
6:00let's call this
6:01username. Now my username and full name are
6:03not the same thing. So let's just go ahead
6:06and select
6:06user and double click username. And again,
6:09I'll just make this large. So you can see,
6:12again, you
6:12can see this is valid. This is all you need
6:14to write. It's very, very simple username.
6:16Now I
6:17can just hit apply this will of course head
6:20over down here to the bottom left hand side
6:22. And now
6:23if I drag username next to domain, you can
6:26see that in this case, my username is
6:28actually my email,
6:29the reason being, I'm actually using Table
6:31au online. So this is always going to be the
6:33case.
6:33Now in some organizations, your username
6:35might be not your email, it might be just a
6:37first name,
6:38dot last name, it might be whatever sort of
6:39structure that's set up for you on Tableau
6:41server
6:42or Tableau online. But this is really
6:44powerful, because essentially, you can
6:47check various details
6:48about the user without ever having to, you
6:50know, do anything. Now, I'm just going to
6:52show you how
6:52you can simulate this and make sure that it
6:54's actually working. So I'm going to go
6:56ahead and
6:56close this little x here. And I'm going to
6:58go to the bottom. And what I said earlier
7:00on is that
7:01actually this other Tim here is actually
7:03using my personal email. So I'm going to
7:05actually have to
7:06grade this out. So you can't see it. So if
7:07I switch to that, you'll see that again, I
7:09'm still
7:10external. But now you can see that it's
7:11switched over to my personal email. If I
7:13switch back to my
7:14other one, then you can see that this is
7:16all good. Okay, so this is a really sort of
7:19nice to use
7:20feature. Now, there are a couple of other
7:22things in this little drop down, if I just
7:23go in here,
7:24and I select new group, you'll see that
7:26everything gets zoned out. Now, the reason
7:29that is, is because
7:30essentially, I'm behaving like I'm just
7:31part of the group. So when you do that, you
7:33don't you're
7:34not actually an individual, it's basically
7:37Tableau is feeding that parameter with
7:39variables and saying
7:40actually, this person is just part of this
7:42group, we don't know who they are. And so
7:44that's why
7:45everything disappears when I select that.
7:47So don't be worried when you select a group
7:49, and everything
7:49disappears. The functions we've written so
7:51far are just about the individual. And
7:53therefore,
7:54that's all you should use them for
7:56essentially pulling the individual
7:57information out,
7:58you might use this to specifically target,
8:01let's say certain group of people with a
8:03specific
8:04calculation, because you know, that's what
8:05they do. But that's not really the best way
8:07to do
8:07things. It's normally better to get the
8:09consistent sort of set of behavior across
8:11every everyone set
8:13up. And then you're able to do that. The
8:14other thing you can do is you can actually
8:16pull this
8:16information and customize the dashboard. So
8:19you could, for example, put a little
8:21message to say,
8:22Welcome to him, today's view is this. And
8:24these are the numbers. So you can actually
8:26build sort
8:26of nice structured sentences using these
8:29functions inside of Tableau. So that's the
8:32sort of typical
8:32use case for these things. Now, the other
8:34group of functions are the ones that allow
8:36you to check
8:37if someone is part of the group. So to do
8:39this, what I'm actually going to need to do
8:41is go back
8:42into my little sort of window here. And I'm
8:44going to click on this data rockstar group.
8:46And I'm just
8:46going to go and grab this, this little name
8:49here at the top, because what I want to do
8:51is actually
8:51create the calculated field and check if
8:54these two things are the same. So now that
8:56I've done that,
8:57let's go back in here. And what we can do
8:59is we can just go ahead and create a new
9:01calculated field,
9:03I'll go down to this drop down here, and I
9:04'll go back to my user functions. So you can
9:07see here
9:08that we have two sort of conditional three
9:10conditional functions, actually, so is full
9:13name
9:13is member of and is username. Okay, so the
9:16is member of is the one I'm going to
9:17actually start
9:18with, okay, returns true if the current
9:20user is a member of the given group false.
9:23Otherwise,
9:24this uses a Tableau server to resolve group
9:26membership, if logged on, otherwise, it
9:28always
9:28returns false. So basically, if it can't
9:30connect to the server, it's going to return
9:33false, which
9:33is important if you're going to use this
9:35for security reasons, okay. But let's go
9:37ahead and
9:38create something called group name. And in
9:40here, I could actually use a parameter for
9:43this, but I'm
9:44just going to type data rockstar in there,
9:45I'm just going to make sure it's exactly
9:47what was on
9:48server, okay. And then that's basically our
9:50group name. Okay, so there, you can see if
9:53I just drag
9:53this out, you can see that the group name
9:56that we just created manually is exactly
9:58the same.
9:59Now, what I'm going to do is I'm going to
10:00switch to the first thing because I know
10:02that person is
10:03not part of this data rockstar group. Okay,
10:05I know that because I set this up, I can
10:07actually show
10:07you that as a matter of fact, you can see
10:09that the data rockstar is actually my other
10:11email, it's not
10:12my personal email. So let's go back in here
10:14. And let's actually try and do this is
10:16member of
10:17function. So now I'm basically, you know,
10:19in this in this group. So let's go ahead,
10:22create a
10:22calculated field. And I can actually just
10:25go and use the function called is is member
10:28of okay,
10:28let's make this larger. And I can just call
10:31this is member of actually just a good name
10:34is member
10:36of, okay. And what I can do is I can
10:38actually then just put group name, okay,
10:41because I created that
10:41previously, I just wanted to make it nice
10:43and easy. So you can see what's going on.
10:45Actually,
10:45when you put it in as a problem. So let's
10:47go look at this argument one is member of
10:50must be a
10:50n string literal. So basically, what this
10:53is saying is I can't put like a calculation
10:56in there.
10:56I think it actually wants me I was trying
10:58to be smart, and it's not worked. So let's
11:01do this. I
11:01think it specifically wants a string and
11:03they go. So that's a nice little quote. I
11:06don't know why
11:06that is actually I would assume that would
11:08have worked that you can clearly see that I
11:10've clearly
11:11tried this. And I must have forgotten how
11:13to work it. So now you can see this is
11:15valid. So this is
11:16all good. And now we can just hit apply.
11:19Okay. And we're going to check if this user
11:22this personal
11:23user is part of the data rockstar group,
11:25and I'm just going to put it next to group
11:27name.
11:27And we should see a false Okay. And now the
11:30key thing here is if I change this to the
11:32other user,
11:33you should see, let's just make sure I
11:35click on the right part, you've got to
11:36click on that arrow
11:37very specifically. If I select him now, you
11:40should see that turns to true, you can see
11:42that I am
11:42indeed a data rockstar, excuse the pun. So
11:45let's go back and you can see that
11:47switching and it works,
11:48everything sort of works as expected, which
11:50is really, really good. The last couple of
11:52functions to check, let's go ahead and
11:54create another calculated field, let's go
11:57to user.
11:57And all the work we did before was
11:59pointless. So basically, I can I can do
12:01this one. So let's
12:02check his full name. And I can go ahead and
12:05type my full name. And both of these are
12:08going to
12:08resolve true, because I'm, I can use the
12:11same name in both instances. So let's just
12:13type this
12:14out as it was. And you can just essentially
12:16see that this is working as expected, I'm
12:18doing this
12:19super fast, because, you know, I know how
12:21to use Tableau. So this is just sort of
12:23normal. But if
12:24let's say I misspelled my name, and I hit
12:26apply, you'll see that that turns to false.
12:28That's a nice
12:29way for us to check that it's actually
12:31doing what it should be doing. Okay, let's
12:33hit apply to get
12:34that back into the right place. Last but
12:36not least, let's duplicate this again,
12:38because you know me,
12:39I'm very lazy. I say this in every video,
12:41and it's really is true. If I go in here
12:44and select user,
12:45you'll see we've done his full name we've
12:47done is member of his username is the last
12:49one. So let's
12:50go ahead and replace this by double
12:52clicking that. And you'll see that actually
12:54decided to wrap
12:55everything around it. That's not what I
12:57wanted. So let's just go ahead and remove
12:59this. I was trying
13:01to be smart again, it just failed to me,
13:03she just stopped being smart. And just
13:05close this, okay.
13:06And let's see if this is going to work. Now
13:08username and full name is slightly
13:10different.
13:11So don't forget, the username is going to
13:13be different. In this case, I will have to
13:15go ahead
13:15and type my email in here. And we'll just
13:18set this to my personal email, I'll have to
13:20blank this out
13:21in the video and hit apply. So his full
13:24name is there. And let's just call this is
13:27username,
13:28and hit apply. And now that we've hit apply
13:30, you'll see that this has gone over down
13:33here.
13:34And now we can go ahead and grab that and
13:36put it at the very end. And you'll see that
13:38his username
13:39on my personal emails was true. But if I
13:42hit OK, and switch over to my other account
13:44, you can see
13:45that it then turns false. So there you go.
13:47These are some amazing Tableau server
13:50functions that you
13:51can use inside of your dashboard to do
13:53specific things for specific people. But
13:55the most useful
13:56one in my opinion, the one that the only
13:58one you should really use here is this one
14:00group name,
14:00because essentially, what this allows you
14:02to do a very sort of good use case is let's
14:05say you work
14:05in fast moving consumer goods. And you have
14:07someone in the biscuits team, you have
14:09someone
14:10in the crisps team, and you have someone in
14:11the cosmetics team, people in lots of
14:13different teams.
14:14And what you might decide to do is you
14:16might decide to add them to specific groups
14:18, if I just go,
14:19if I just exit out of the mark, select
14:21everything, oh, God, what am I doing here,
14:24if I just exit out
14:25of that, and deselect everything, you might
14:28actually go ahead and decide to create a
14:30group
14:30for each of those business units, because
14:32those business units apply across the whole
14:34entire
14:34organization. And then what you can do is
14:36you can actually go in here and write
14:38conditional
14:39calculations, because it's really common in
14:41fast moving consumer goods that the biscuit
14:43team
14:44calculate return on investment on
14:46advertising a completely different way to,
14:48for example,
14:49cosmetics team, because those two different
14:51parts of the business might be actually,
14:53you know,
14:54doing different kinds of promotions and
14:56different kinds of financial transactions
14:58altogether. So you
14:59might have to sort of do conditional
15:00calculations for different types of the
15:02business, depending on
15:04who they are. And essentially, you do that
15:05for the individual and where they belong.
15:07And the other
15:08way to do it would be a parameter. So you
15:10could give the user parameter to be able to
15:12change that.
15:13But if you're pretty dead certain about how
15:14something's going to work, then this is
15:16sort
15:17of one way of doing it. That's probably not
15:18the best use case, but just an example of
15:20what you
15:21could do with this function once you've got
15:22it working. So that's pretty much it. I
15:24hope you've
15:25enjoyed this video. I hope you've maybe
15:26thought of some more interesting ways you
15:28could use this.
15:29Essentially, all these functions allow you
15:31to check a user status on Tableau server on
15:33Tableau
15:34online, and then it allows you to do things
15:36with them inside of a calculation. So you
15:38've got three
15:38Boolean functions is member of is full name
15:41and is username. And then you've got some
15:43other functions
15:44which just return information to group name
15:46, username and domain just return the values
15:49to you.
15:49Okay, thanks for watching. I'll catch you
15:51in the next video. If you haven't done so
15:52already, check
15:53out TableauSim.com. Follow me on Twitter
15:55and every other place that you might be on
15:57social media with
15:58and I'll catch you in the next video!
In this video I walk through the 6 user functions you can use to pass through conditionality controlled by a users Tableau Server or Tableau Online status. I cover the following user functions: FULLNAME( ) e.g. [Manager]=FULLNAME( )ISFULLNAME(string) e.g. ISFULLNAME(“Dave Hallsten”)ISMEMBEROF(string) e.g. IF ISMEMBEROF(‘domain.lan\Sales’) THEN “Sales” ELSE “Other” ENDISUSERNAME(string) e.g. ISUSERNAME(“dhallsten”)USERDOMAIN( ) e.g.[Manager]=USERNAME() AND [Domain]=USERDOMAIN()USERNAME( ) e.g. [Manager]=USERNAME( )Tableau Release Notes:User functions can be used to create user filters or row-level security filters that affect visualizations published to Tableau Server or Tableau Online, so that only certain people can see your visualization.For example, if you have a visualization that shows the sales performance for each employee in your department published on Tableau Server or Tableau Online, you might want to only allow employees to see their own sales numbers when they access that visualization.https://help.tableau.com/current/pro/desktop/en-us/functions\_functions\_user.htm