Tableau function User

Tableau ISFULLNAME to SQL

ISFULLNAME("Mai Tran") is true only when the viewer's display name is Mai Tran; it is shorthand for FULLNAME() = "Mai Tran". In SQL, compare the full name your app passes in. The database's current_user is the connection's login and knows nothing about display names. The sample runs as a stand-in viewer: user name TIN\analyst, full name Local Analyst, domain TIN, in no groups. In SQL the viewer is a one-row viewer table; in production your app passes it in.

Updated · Checked on the xmetric engine

What is the syntax?

ISFULLNAME("full name")
full name
a string constant: the display name to test, such as 'Mai Tran'.

Returns a boolean: true when the viewer's full name equals the string. The same value on every row.

What does it return, and what is the SQL?

Each example runs on the same 6 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.

Is the viewer Local Analyst?

Tableau

ISFULLNAME('Local Analyst')

SQL (DuckDB)

WITH viewer AS (
  SELECT
    'TIN\analyst' AS username,
    'Local Analyst' AS fullname,
    'TIN' AS domain
)
SELECT v.fullname = 'Local Analyst' AS result
FROM input i, viewer v
ORDER BY i.id

True on every row.

Result
true
true
true
true
true
true

The Tableau formula and the SQL return the same 6 rows.

How do I show sales only to Mai Tran?

Tableau

IF ISFULLNAME('Mai Tran') THEN [Sales] ELSE 0 END

SQL (DuckDB)

WITH viewer AS (
  SELECT
    'TIN\analyst' AS username,
    'Local Analyst' AS fullname,
    'TIN' AS domain
)
SELECT
  CASE
    WHEN v.fullname = 'Mai Tran' THEN i.Sales
    ELSE 0
    END AS result
FROM input i, viewer v
ORDER BY i.id

The stand-in viewer is not Mai Tran, so every row shows 0.

SalesResult
4200
3100
1500
2750
900
5150

The Tableau formula and the SQL return the same 6 rows.

Where does a straight translation go wrong?

Common mistake

Why does current_user not match the viewer?

current_user is the database login (duckdb here), never a display name, so the test is false for everyone.

Tableau

ISFULLNAME('Local Analyst')

Tempting SQL

SELECT current_user = 'Local Analyst' AS result
FROM input
ORDER BY id

SQL that matches

WITH viewer AS (
  SELECT
    'TIN\analyst' AS username,
    'Local Analyst' AS fullname,
    'TIN' AS domain
)
SELECT v.fullname = 'Local Analyst' AS result
FROM input i, viewer v
ORDER BY i.id
TableauTempting SQLSQL that matches
truefalsetrue
truefalsetrue
truefalsetrue
truefalsetrue
truefalsetrue
truefalsetrue

The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.

How do I write it in Snowflake or BigQuery?

The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.

Snowflake

SELECT $ viewer_fullname = 'Mai Tran' AS result
FROM input
ORDER BY id

Snowflake documentation

BigQuery

SELECT @ viewer_fullname = 'Mai Tran' AS result
FROM input
ORDER BY id

BigQuery documentation

What does your own ISFULLNAME formula return?

Edit the formula and run it on the 6 sample rows. Fields: [id], [Region], [Owner], [OwnerName], [Sales].

Runs in your browser on the xmetric engine. Nothing is uploaded.

Which functions go with it?

What do people ask about ISFULLNAME?

How do I get the Tableau user into the database?

The database only knows the account Tableau connects with. Pass the viewer in: Tableau's Initial SQL can use the [TableauServerUser] parameter, or your app sets a session variable or a query parameter. Then filter with it, as the viewer table does on this page.

What does it return in Tableau Desktop?

When you are signed in to Tableau Server or Cloud, the server's user. Otherwise Desktop uses your local or network identity. Test row-level security as a real viewer on the server, not from Desktop.

Should I secure rows by full name?

Prefer the user name. Display names can repeat and change; user names are unique on a Tableau site.

Where is this documented?