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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vini_udenia
Helper I
Helper I

How to get user full name from active directory

Hi,

 

I'm implementing RLS and while doing so need to filter the data based on the User who has logged in. So that each user only sees his or her own records. The 2 DAX functions username() and userprincipalname() return the domain user name and the email address.

 

example:

username() returns AD\edwardh

userprincipalname() returns edward.hall@xxxx.com

 

What I need is the full name: Edward Hall for comparision to the data. How can this be extracted?

 

1 ACCEPTED SOLUTION

Hi there

What I would suggest doing is using the Active Directory connector and get all the users names into your data model.

After that you can then get their UPN and map them accordingly.

Here is a blog post explaining how to do this: https://www.fourmoo.com/2018/02/20/dynamic-row-level-security-is-easy-with-active-directory-security...




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

5 REPLIES 5
GilbertQ
Super User
Super User

Hi there

What you actually need is the edward.hall@xxxx.com

In the Power BI Service it ONLY uses the USERPRINCIPALNAME()




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Hi Gilbert,

Thansk for your reply but my data is following format:

SalespersonName             Country           Sales

-----------------------------------------------------

Edward Hall                      Singapore       10,000

Mark Twain                       UK                   20,000

 

On the query I want apply the filter [SalespersonName] = <Name of the user who is viewing the report>

 

USERPRINCIPALNAME() will return is edward.hall@xx.com which I can't equate to the Salesperosn Name. The email might not always have the user full name as well, For Mark email can be mark.t@xxx.com, so I cnat derive the Full Name from email address.

Hi there

What I would suggest doing is using the Active Directory connector and get all the users names into your data model.

After that you can then get their UPN and map them accordingly.

Here is a blog post explaining how to do this: https://www.fourmoo.com/2018/02/20/dynamic-row-level-security-is-easy-with-active-directory-security...




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

That worked! Thanks Gilbert!

Awesome thanks for letting us know!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors