The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys,
I'm new using Power BI. I created a measure Username = username(), which returned that.
Then I changed the expression to return User: Name, but the name is lower case.
I want the name first letter upper and the rest lower, as in the example below. How can I do it?
Thanks
Solved! Go to Solution.
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:
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.
@nmcp22
Here is a solution that works for one word user name https://www.dropbox.com/t/gG8TzH0N6tJJPJgA
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] )
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.
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |