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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
nmcp22
New Member

How to capitalize the first letter in this situation

Hi guys,

 

I'm new using Power BI. I created a measure Username = username(), which returned that.

 

nmcp22_4-1658323225561.png

 

Then I changed the expression to return User: Name, but the name is lower case.

User = CONCATENATE("User: ",mid(USERNAME(),find("\",USERNAME())+1,LEN(USERNAME())))
 

nmcp22_7-1658323514926.png


I want the name first letter upper and the rest lower, as in the example below. How can I do it?

nmcp22_8-1658323697391.png

 

 

Thanks

 

1 ACCEPTED SOLUTION

Hi @nmcp22 
I tried with my USERENAME ( ) and seems to work just fine.

2.png1.png

View solution in original post

6 REPLIES 6
v-jianboli-msft
Community Support
Community Support

Hi @nmcp22 ,

 

According to your description, I modified your original DAX. Please try:

 

User =

var _name = mid ( USERNAME (), find ( "\" , USERNAME ())+ 1 ,LEN ( USERNAME ()))

var _U = UPPER(LEFT(_name,1))

var _L = LOWER(RIGHT(_name,LEN(_name)-1))

return CONCATENATE("User:",CONCATENATE(_U,_L))

 

Output:

vjianbolimsft_0-1658732792191.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Super User
Super User

@nmcp22 

Please share the code that ended up with

tamerj1
Super User
Super User

@nmcp22 
Here is a solution that works for one word user name https://www.dropbox.com/t/gG8TzH0N6tJJPJgA

1.png

Username = 
VAR CurrentUser = SELECTEDVALUE ( UserNames[USER] )
VAR String = SUBSTITUTE ( CurrentUser, "\", "|" )
VAR String1 = "User"
VAR String2 = PATHITEM ( String, 2 )
VAR Length = LEN ( String2 )
VAR T1 = GENERATESERIES ( 1, Length, 1 )
VAR T2 = 
    ADDCOLUMNS ( 
        T1, 
        "@Letter", 
        VAR Letter = MID ( String2, [Value], 1 )
        RETURN
            IF ( [Value] = 1, UPPER ( Letter ), Letter )
    )
RETURN
    String1 & "\" & CONCATENATEX ( T2, [@Letter] )
tamerj1
Super User
Super User

Hi @nmcp22 
The username is usually one word. Just to confirm because the solution could be different, is there any possibility to be one than one word?

Hi @tamerj1,

Thank you for replying and sharing the document.

 

Yes, the expression "= username()" just returns one name after "\" but in lower case (in my case). 

I am trying to transform this name into a Proper case.

I followed the steps you sent me, which still show lower case names, or I am missing some steps.

Hi @nmcp22 
I tried with my USERENAME ( ) and seems to work just fine.

2.png1.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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