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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RichFlorida
Helper V
Helper V

DAX (or M) Function to retrieve First & Last Name

Is there a DAX or M function I can use to dynamically display the First and Last Name of the logged in user?

 

p.s. I can't use username(), nor UserPrincipalName(), as they do not provide this info.

 

Example:

 

UserID: jd22334       <--- username()

email: jd22334@domain.com  <---- UserPrincipalName()

First & Last name: John Doe    <--- ???

 

Thanks!

10 REPLIES 10
OliverO
Helper III
Helper III

I think you would need to import some sort of data for Power BI to use to do a look up.

Without that, I think you will find it very difficult

RichFlorida
Helper V
Helper V

I have 500 users.

I'm looking to see if there is a DAX (or M) function that could capture the First & Last name once ser logged into PowerBI service to view report.

 

Something similar to existing functions that campture username and email!!!

OliverO
Helper III
Helper III

to turn jd22334 into John Doe, you will need more information that just their login id.

 

If all you can ever get is jd22334, you can't do it

 

How many users do you have?  

RichFlorida
Helper V
Helper V

Any ideas regarding this are greatly appreciated.

OliverO
Helper III
Helper III

Can you maintain a user list?

Might be tricky otherwise

OliverO
Helper III
Helper III

cool

So can you create a table like

User id    FirstName    Surname

jd22334  John             Doe

bb1123   Bugs             Bunny

mm123   Mickey         Mouse

Hi @OliverO 

 

I can't create a table, as I need to capture the name dynamically based on the currently logged in user interacting with the Dashboard.

RichFlorida
Helper V
Helper V

@OliverO 

I mean they provide userID and email address of logged user, not the First and Last Name!!!

 

Example:

First & Last name: John Doe

UserID: jd22334       <--- username()

email: jd22334@domain.com  <---- UserPrincipalName()

OliverO
Helper III
Helper III

I think I know what you mean

eg they login as jsmith@blah.com

can you have a table of usernames, first names and surnames?

eg

jsmith | John | Smith 

and just do a lookup?

OliverO
Helper III
Helper III

Hi

What do you mean "they do not provide this info"?

How do they login to the service?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.