Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

0

USERNAME(): Windows user name

Good afternoon Dear Mr.(a),

am using the DAX function USERNAME() to show the user name loged in windows.

 

I am using the following measurement:

Fulfillment =
VAR Hour = HOUR(NOW())
VAR Greeting =
SWITCH(TRUE(),
Time >= 5 && Time < 12, "Good morning",
Time >= 12 && Time < 18, "Good afternoon",
Time >= 18 && Time < 24, "Good evening",
Time >= 0 && Time < 5, "Good morning",
"Hello")

 

However, after the report was published instead of the windowns user name my email from the power bi service appears. i tried to switch to the USERPRINCIPALNAME() function but i got the same result.

 

On any machine that I open the published report, my e-mail from the power bi service appears.

how to solve it?

Status: Delivered

Hi @GuerreiroJunior 

In PBI Desktop , USERNAME() returns the machine name , USERPRINCIPALNAME() returns the Service account . But when you publish them to PBI Service , they all return the Service account . It's by design .

USERPRINCIPALNAME function (DAX) - DAX | Microsoft Learn

USERNAME function (DAX) - DAX | Microsoft Learn

 

Best Regards,
Community Support Team _ Ailsa Tao

Comments
v-yetao1-msft
Community Support
Status changed to: Delivered

Hi @GuerreiroJunior 

In PBI Desktop , USERNAME() returns the machine name , USERPRINCIPALNAME() returns the Service account . But when you publish them to PBI Service , they all return the Service account . It's by design .

USERPRINCIPALNAME function (DAX) - DAX | Microsoft Learn

USERNAME function (DAX) - DAX | Microsoft Learn

 

Best Regards,
Community Support Team _ Ailsa Tao