USERNAME
The user the query runs as (on OpenBI Server, the person's e-mail); empty text when there is none.
Group: Information. Compatible with DAX.
Syntax
USERNAME ( )
It takes no parameters.
Returns
Text. The name of the user the query runs as: 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.
- In a role's filter it decides which rows each person sees, for example
Managers[E-mail] = USERNAME ()on a table that lists who manages which shop. USERPRINCIPALNAMEandUSEROBJECTIDgive the same text in OpenBI.
Compared with DAX
Power BI Desktop gives the Windows account as DOMAIN\user, and the Power BI service the user's sign-in name. OpenBI gives the e-mail address on a server and nothing in OpenBI Studio, unless See as names a user.
Examples
Who runs this query
The answer depends on who asks, and where.
EVALUATE
ROW ( "User", USERNAME () )
| User |
|---|
| (varies) |
Related functions
USERPRINCIPALNAME, USEROBJECTID, CUSTOMDATA, USERCULTURE, LOOKUPVALUE.