Forum Discussion
How to split specific character from Widows AD Name
- 4 years ago
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 )
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 "[email protected]".
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 ("[email protected]") 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...?
- PC27904 years ago
Community Champion
You can try this if it solves your purpose:
UNam = VAR Finddelimiter = FIND("@",USERPRINCIPALNAME(),1)returnMID(USERPRINCIPALNAME(),1,Finddelimiter-1)- saivina29204 years ago
Post Prodigy
Ok..Is there any DAX measure to split again from then name..?
I have "[email protected]" 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"...?
- PC27904 years ago
Community Champion
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 )