Insights / RLS in Power BI / Part 5

Part 5 of 20 · Build it

USERPRINCIPALNAME vs USERNAME in Power BI RLS

By Zohal Zahir · November 2026 · From the series Who sees what: RLS in Power BI

The problem. Your role DAX looks right, but your security table matches nothing.

Why. An RLS rule keeps the rows where a column equals the current user. Power BI has four functions for "the current user", and they don't return the same thing. The value the function returns must exactly match a value stored in your model.

Function Returns Store in your table Use it when
USERPRINCIPALNAME() The user's sign-in email (UPN) Emails Almost always. The default
USEROBJECTID() The Entra Object ID (a GUID that never changes) GUIDs, plus an email column for people to read Emails change often, or guests keep breaking the match
USERNAME() The UPN in the Power BI service; DOMAIN\user in Desktop and on-premises Analysis Services Depends where it runs Matching Windows accounts on-premises
CUSTOMDATA() A string an embedding app passes in (blank in normal reports) Tenant or customer IDs Embedded, multi-tenant apps (Part 6)
[Email]      = USERPRINCIPALNAME()
[ObjectId]   = USEROBJECTID()
[CustomerId] = CUSTOMDATA()

The fix. Pick the function first. Then build the column that stores exactly what it returns.

CUSTOMDATA() doesn't work in role rules on DirectQuery models (Part 15).

Check before go-live

  • The role uses USERPRINCIPALNAME() unless there's a clear reason not to Desktop
  • Every value in the security table is a valid, trimmed UPN with no duplicates Desktop

Want a second pair of eyes on your own model? The RLS review checks your roles, relationships and workspace access against this checklist, at a fixed price.

Found this useful? Share it.Tag Zohal Zahir on LinkedIn so she can say thanks.

Want your RLS checked on a real model?

Book a free 30-minute call. Tell us how your model and workspaces are set up, and we'll tell you where access could leak and what fixing it would involve.

Book a free call30 minutes. Reply within two business days