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
saivina2920
Post Prodigy
Post Prodigy

How to split specific character from Widows AD Name

I want to display Active Directory user name in my dashboard using label or textbox.

How to get current AD name and display in label or textbox...?

For Example my current Windows AD name would be "ccnet\joseph"

 

I want to display in my label as Hi "Jospeh" would be the final name to be displayed in label or textbox..

 

How to split only name from my current AD name...?

 

1 ACCEPTED SOLUTION

Here you go:

 

UNam =
VAR Finddelimiter =
FIND ( "@", USERPRINCIPALNAME (), 1 )
VAR DomainName =
MID ( USERPRINCIPALNAME (), 1, Finddelimiter - 1 )
VAR FindDelimiterDot =
FIND ( ".", DomainName, 1 )
VAR FirstName =
MID ( DomainName, 1, FindDelimiterDot - 1 )
VAR LastNameInitial =
MID ( DomainName, FindDelimiterDot + 1, 1 )
RETURN
UPPER ( LEFT ( FirstName, 1 ) )
& RIGHT ( FirstName, LEN ( FirstName ) - 1 ) & " "
& UPPER ( LastNameInitial )

View solution in original post

11 REPLIES 11
PC2790
Community Champion
Community Champion

If you have your Windows AD Name in any column then you can try to create a new calculated column like this:

 

UName = RIGHT(Table[Column1],FIND("\",Table[Column1],1,LEN(Table[Column1])))
 
Result will be like:
PC2790_0-1649307465468.png

 

Thanks for your quick response.

 

Is it possible to directly read from windows AD name and split it.?

You can connect to Windows AD, refer this 

Thanks for the guidance.

I want to read only specific name who has logging in to the system which means AD user name..

Now i am getting "ct1net\201980" from logging into the system.

Using this id, i want to get the name of the specific user....

How to do this...?

Ok, Try this:

 

UName = VAR FindSlash = FIND("\",USERNAME(),1)
return
MID(USERNAME(),FindSlash+1,LEN(USERNAME()))

Ok..You are correct to get windows user name (It is windows user account id). But, It doesn't contain any user full name.

If we want to get user name from AD, I think "sn" is the field name.

Or

we can user userprincipalname. It contains mail id along with domain.

For example, USERPRINCIPALNAME is "Joseph.Johnson@companyname.com".

To get final user name we can use this mail id and split the name of the mail id.

Final Name is " Joseph J" is the result...

Is is possible from mail id ("Joseph.Johnson@companyname.com")  to get the above name "Joseph J").

I think the above step is easy way to get the name of the user..

What is you suggestion pls...?

You can try this if it solves your purpose:

 

UNam = VAR Finddelimiter = FIND("@",USERPRINCIPALNAME(),1)
return
MID(USERPRINCIPALNAME(),1,Finddelimiter-1)

Ok..Is there any DAX measure to split again from then name..?

I have "Joseph.Johnson@companyname.com" and return to Joseph.Johnson.

From this, again i want one more split and finally name would be Joseph J (I want to remove dot(.) and second name should be the initial only.

so final name is "Joseph J"...?

Here you go:

 

UNam =
VAR Finddelimiter =
FIND ( "@", USERPRINCIPALNAME (), 1 )
VAR DomainName =
MID ( USERPRINCIPALNAME (), 1, Finddelimiter - 1 )
VAR FindDelimiterDot =
FIND ( ".", DomainName, 1 )
VAR FirstName =
MID ( DomainName, 1, FindDelimiterDot - 1 )
VAR LastNameInitial =
MID ( DomainName, FindDelimiterDot + 1, 1 )
RETURN
UPPER ( LEFT ( FirstName, 1 ) )
& RIGHT ( FirstName, LEN ( FirstName ) - 1 ) & " "
& UPPER ( LastNameInitial )

It's perfect.

amitchandak
Super User
Super User

@saivina2920 , In Power query, add a new column using text after the delimiter

Text Before Delimiter and Text After Delimiter: https://youtu.be/oGY4RoPKDOE

 

Or use split by delimiter in power query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.