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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Dynamic Message using the system username

Hi there!  i have this code which consists of making a greeting to the person who enter the dashboard, how do I get the system username printed on the message? like.. if the system is called "John Computer" I want the message to appear "Good afternoon John Computer,  is that's possible? 

 

Welcome Text =
VAR Hour = HOUR(NOW())
VAR Greeting =
SWITCH(
TRUE(),
Hour >= 0 && Hour < 5, "Good Night",
Hour >= 5 && Hour < 12, "Good Morning",
Hour >= 12 && Hour < 18, "Good Afternoon",
Hour >= 18 && Hour < 24, "Good Evening"
)
RETURN
Greeting & " Murilo"
3 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @Anonymous 

RETURN
Greeting & USERNAME ( )
but in most cases usernames are not the perfect shape therefore some extra editing (using dax) might be required 

View solution in original post

@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

View solution in original post

tamerj1
Super User
Super User

@Anonymous 
Hello again. You can refer to the sample file for a method to split first and last names https://we.tl/t-gkFZ77JFsJ

Greeting = 
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

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

@Anonymous 
Hello again. You can refer to the sample file for a method to split first and last names https://we.tl/t-gkFZ77JFsJ

Greeting = 
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
tamerj1
Super User
Super User

Hi @Anonymous 

RETURN
Greeting & USERNAME ( )
but in most cases usernames are not the perfect shape therefore some extra editing (using dax) might be required 
Anonymous
Not applicable

lol it was that simple, thanks! one other question, this is the username of the system but there's a way to just pull the Name? the system name might  be John Computer but in the account is just called John, there's a way to just get only the computer profile name?

@Anonymous 

We cannot pull the computer name but we can edit the username and modify it. If you are interested give me some examples of what are the actual usernames and would you exoect to see as a result. 

Anonymous
Not applicable

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.