DAX function
USERNAME — DAX function reference
Current user (domain\user).
Syntax
dax
USERNAME()
Examples
dax
USERNAME()
→ A user string
dax
"Report viewed by: " & USERNAME()
→ A debug/audit text box showing who is viewing
Matches the legacy domain\user format, more common on-premises with Analysis Services than in the Power BI Service.
dax
IF(USERNAME() = "CONTOSO\\jdoe", TRUE(), FALSE())
→ true / false
Common mistakes & gotchas
- In the Power BI Service, USERNAME() typically returns the same UPN/email as USERPRINCIPALNAME(), but on Analysis Services or Desktop it can return a Windows domain\username instead — don’t assume the format without checking the actual deployment target.
- Because its return format isn’t guaranteed consistent across environments, most RLS implementations that need to work both on-prem and in the Service standardize on USERPRINCIPALNAME() instead.
Related DAX functions
From Security & context info