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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MitieFred
Helper V
Helper V

DAX equivalent to the Excel Proper function

My input data, from an import from SharePoint, contains the following

 

i:0#.f|membership|jason.king@prisoner.com

 

I know how to get the jason king part of the person's name (Mid/Left/Right etc) but I'm looking to be able to capitalise the first letter of each part of the name, ending up with Jason King. 

 

There appears to be no DAX equivalent of excel's Proper, or am i wrong ?

 

Regards

Fred

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @MitieFred ,

 

In the Query Editor, go to the Transform tab, select Format, and select Capitalize Each Word.

And if you want use it in your measure then you can use below code:-

Column =
VAR _lastName =
    MID (
        [Your_string],
        SEARCH ( " ", [Your_string], 1, 1 ),
        LEN ( [Your_string] ) - 1
    )
VAR _firstName =
    MID ( [Your_string], 1, SEARCH ( " ", [Your_string], 1, 1 ) - 1 )
RETURN
    UPPER ( LEFT ( _firstName, 1 ) )
        & RIGHT ( _firstName, LEN ( _firstName ) - 1 ) & " "
        & UPPER ( LEFT ( TRIM ( _lastName ), 1 ) )
        & RIGHT ( TRIM ( _lastName ), LEN ( TRIM ( _lastName ) ) - 1 )

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

3 REPLIES 3
Samarth_18
Community Champion
Community Champion

Hi @MitieFred ,

 

In the Query Editor, go to the Transform tab, select Format, and select Capitalize Each Word.

And if you want use it in your measure then you can use below code:-

Column =
VAR _lastName =
    MID (
        [Your_string],
        SEARCH ( " ", [Your_string], 1, 1 ),
        LEN ( [Your_string] ) - 1
    )
VAR _firstName =
    MID ( [Your_string], 1, SEARCH ( " ", [Your_string], 1, 1 ) - 1 )
RETURN
    UPPER ( LEFT ( _firstName, 1 ) )
        & RIGHT ( _firstName, LEN ( _firstName ) - 1 ) & " "
        & UPPER ( LEFT ( TRIM ( _lastName ), 1 ) )
        & RIGHT ( TRIM ( _lastName ), LEN ( TRIM ( _lastName ) ) - 1 )

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Appreciate the solution, but its kinda nuts that there isnt a built in formula for this like in Excel.

Thanks @Samarth_18 that pointed me in the right direction as I found that some of the entries had either no second name or were entirely missing, but your code gave me the right starting point

 

regards

Fred

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors