cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vigneshmani05 Helper I
Helper I

USERPRINCIPALNAME() and USERNAME() returns same result

Hi All,

I am facing issue with USERPRINCIPALNAMEand USERNAME both returning same result login name in my destop file.
when i publish to app.powerbi.com am seeing result as login email for both!!! 

Any one faced this issue and have any solution for it
Thanks in advance!!

3 REPLIES 3
Highlighted
Microsoft V-pazhen-msft
Microsoft

Re: USERPRINCIPALNAME() and USERNAME() returns same result

@vigneshmani05 

 

In Power BI Desktop, username() returns a user in the format of DOMAIN\User and userprincipalname() returns a user in the format of username@microsoft.com

 

In Power BI Service, username() and userprincipalname() both return the userprincipalname, which is the email address format.

Best,
Paul

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly, Kudos is nice too.

vigneshmani05 Helper I
Helper I

Re: USERPRINCIPALNAME() and USERNAME() returns same result

Hi @V-pazhen-msft  yes thats the expected behavior, but in desktop iam getting DOMAIN\User for both the function. Not sure why this is happening in desktop, am using latest version nov 2019.

Microsoft V-pazhen-msft
Microsoft

Re: USERPRINCIPALNAME() and USERNAME() returns same result

@vigneshmani05 

Is your account assigned to a domain? Please first check with your UPN with "whoami" in cmd.
One of my collegue also experienced the same issue, where both functions return his computer name(Desktop_xxxx\name) instead of account name. . This is because he was removed from the domain. 

Paul

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors