Forum Discussion
USERPRINCIPALNAME() to Display Name
Hi,
I'm trying out the USERPRINCIPALNAME() function. So it displays the email address which is expected.
I have a dataset that has two columns, Name and Email Address. But in this case, since this is a measure, I can't do a relationship.
Is there a way to convert it to the display name of the email address?
Nevermind I managed to resolve it based on this thread: Solved: How to display Username with greetings when user ... - Microsoft Power BI Community
This is the code I used to achieve my initial problem:Display Name = VAR user = USERNAME() VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user) RETURN(display)
3 Replies
- onurbmiguel_Power Participant
Hi RLSid17
Do you want to filter so you can only see what is associeted to the current user?
For that you need to configure RLS , take a look at:
https://radacad.com/dynamic-row-level-security-with-profiles-and-users-in-power-bi
https://learn.microsoft.com/en-us/power-bi/enterprise/service-admin-rls
Other option is to create a calculated column where you will use the measure, it will work as as "Flag".
More help send a pbix with some dummy values and what do you eant as final result
Best regards
Bruno Costa | Continued Contributor
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 👍
Take a look at the blog: PBI Portugal
- RLSid17Helper III
Hi onurbmiguel_
Yes, I have tried RLS and it works the only thing is that I need to be able to change the email address to display name. For example (I'm using a sample from the link you have provided):
If it detects the user, is there a way for it to be converted into "Reza Rad" instead of "[email protected]"?
I have a table that has the Name and the Email Address column. Is there a way for the USERPRINCIPAL() function in which it displays the email address to look up the Name that corresponds?
- RLSid17Helper III
Nevermind I managed to resolve it based on this thread: Solved: How to display Username with greetings when user ... - Microsoft Power BI Community
This is the code I used to achieve my initial problem:Display Name = VAR user = USERNAME() VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user) RETURN(display)