USERPRINCIPALNAME
The user the query runs as: on OpenBI Server, the person's e-mail, as roles' filters use it.
Group: Information. Compatible with DAX.
Syntax
USERPRINCIPALNAME ( )
It takes no parameters.
Returns
Text. The user the query runs as, by sign-in name: on an OpenBI Server, their e-mail address.
Remarks
- In OpenBI Studio there is nobody signed in, so it is empty text, except when the Security view's See as names a user: then it is the e-mail address given there, to try out a role's filter.
- On an OpenBI Server it is the e-mail address the person signed in with. A server administrator who views a report as someone else gets that person's address.
- It is the usual function in a role's filter:
Managers[E-mail] = USERPRINCIPALNAME ()keeps each person's own rows. Text is compared without regard to case, so the spelling of the address in the table does not matter. - The same text as
USERNAMEandUSEROBJECTIDin OpenBI.
Compared with DAX
In Power BI Desktop it gives the account signed in to Power BI. OpenBI Studio has no sign-in: it is empty unless See as names a user.
Examples
Who runs this query
EVALUATE
ROW ( "Signed in as", USERPRINCIPALNAME () )
| Signed in as |
|---|
| (varies) |
A test a role's filter makes
TRUE for the person whose address it is, FALSE for anyone else.
EVALUATE
ROW ( "Is it Anna", USERPRINCIPALNAME () = "anna@example.com" )
| Is it Anna |
|---|
| (varies) |