Here you have general tips on how to simulate PROPER function in DAX. That for sure is possible though there is no native function in DAX for that.
The algorithm for Proper function is:
- Get your string to VAR variable.
- Convert it to LOWER.
- Convert it to list by splitting it with [space] delimiter.
- Use REPLACE function to replace the first letter of every string in a list with UPPER.
- CONCATENATE the list back to string.
This should be a good starting point:
https://community.powerbi.com/t5/Desktop/DAX-how-split-a-string-by-delimiter-into-a-list-or-array/td-p/559597
Edit.
Here is how to convert text string to proper case with DAX.
I made it the other way.
Start with a sample table:
Table =
DATATABLE(
"ID" , INTEGER ,
"Text" , STRING ,
{
{ 1 , "The quick brown fox jumps over the lazy dog" } ,
{ 2 , "Happy Birthday" }
}
)
Then add this DAX code as a calculated column:
Text Proper =
VAR SplitByCharacter = " "
var var_text = 'Table'[Text]
VAR Table0 =
ADDCOLUMNS (
GENERATE (
CALCULATETABLE( 'Table', 'Table'[Text] = var_text ), // we shrink table to current row only
VAR TokenCount =
PATHLENGTH ( SUBSTITUTE ( 'Table'[Text], SplitByCharacter, "|" ) )
RETURN
GENERATESERIES ( 1, TokenCount )
),
//"Word", PATHITEM ( SUBSTITUTE ( 'Table'[Text], SplitByCharacter, "|" ), [Value] ),
//"cnt", PATHLENGTH ( SUBSTITUTE ( 'Table'[Text], SplitByCharacter, "|" ) ),
"Proper",
var word = PATHITEM ( SUBSTITUTE ( 'Table'[Text], SplitByCharacter, "|" ), [Value] )
var word_Propper = UPPER( LEFT( word, 1 ) ) & LOWER( RIGHT( word, LEN( word) - 1 ) )
return
word_Propper
)
RETURN
CONCATENATEX( Table0, [Proper], " " )
I cooked this code with inspiration of the article by Phil Seamark:
https://dax.tips/2019/07/05/dax-pivot-text-into-a-list-of-words/