Forum Discussion
Dynamic Message using the system username
- 4 years ago
Hi Anonymous
RETURNGreeting & USERNAME ( )but in most cases usernames are not the perfect shape therefore some extra editing (using dax) might be required - 4 years ago
Anonymous
You can doGreeting = VAR Greeting = "Good Morning" VAR FullName = "/CompanyNET/AnneAlavarci/" --Use USERNAME ( ) Function VAR Items = SUBSTITUTE ( FullName, "/", "|" ) VAR NameOnly = PATHITEM ( Items, 3 ) RETURN Greeting & " " & NameOnlyHowever, if both first and last names are proper case (first letter is capital) maybe there is a chance that we can split them. I will also look into that but for now I have to leave for some urgent business. Thank you
- 4 years ago
Anonymous
Hello again. You can refer to the sample file for a method to split first and last names https://we.tl/t-gkFZ77JFsJGreeting = VAR Greeting = "Good Morning" -- You can refer to a measure with switch statement based on NOW ( ) Function VAR FullName = "/CompanyNET/AnneAlavarci/" --Use USERNAME ( ) Function VAR Items = SUBSTITUTE ( FullName, "/", "|" ) VAR NameOnly = PATHITEM ( Items, 3 ) VAR T3 = VALUES ( 'Capital Letters'[Letter] ) VAR T4 = ADDCOLUMNS ( T3, "@Position", FIND ( [Letter], NameOnly, 2, 0 ) ) VAR T5 = FILTER ( T4, [@Position] > 1 ) VAR Position = MAXX ( T5, [@Position] ) VAR Replacement = " " & MAXX ( T5, [Letter] ) VAR NewName = REPLACE ( NameOnly, Position, 1, Replacement ) RETURN Greeting & " " & NewName
Ok! So.. the actual usernames are things like /COMPANYNET/username and i just want to show the username..
Example :
Actual : Good Morning /CompanyNET/AnneAlavarci/
What i need : Good Morning AnneAlavarci
I couldnt find much information about these type of string manipulation in dax
Anonymous
You can do
Greeting =
VAR Greeting = "Good Morning"
VAR FullName = "/CompanyNET/AnneAlavarci/" --Use USERNAME ( ) Function
VAR Items = SUBSTITUTE ( FullName, "/", "|" )
VAR NameOnly = PATHITEM ( Items, 3 )
RETURN
Greeting & " " & NameOnly
However, if both first and last names are proper case (first letter is capital) maybe there is a chance that we can split them. I will also look into that but for now I have to leave for some urgent business. Thank you