Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi PowerBI community,
I am keen to understand if it is possible to add space between texts using Uppercase as an indicator of where the space should be:
For instance: "IronmanMarvelSuperhero" to "Ironman Marvel Superhero"
Is this possible? if it is how do we do this in DAX?
Hey again @JuggernautProf
That's odd - you shouldn't receive those errors if the code has been placed in a calculated column. Then only dependency on the existing model is the reference to 'Text'[Text] at the start.
One thing we may need to consider is handling of blank/empty strings.
Could you share a link to a sanitised PBIX demonstrating the issue (OneDrive, Google Drive etc), or a screenshot of the Power BI interface showing the table where you're adding the column?
This would probably be best handled further upstream, in data source or Power Query.
However, something like this is possible with DAX.
Here is the code for a calculated column (PBIX attached):
Text With Spaces =
VAR CurrentText = 'Text'[Text]
VAR SpaceCode = UNICODE ( " " )
VAR UpperMin = UNICODE ( "A" )
VAR UpperMax = UNICODE ( "Z" )
VAR NumChars = LEN ( CurrentText )
VAR PositionCode =
SELECTCOLUMNS (
GENERATESERIES ( 1, NumChars ),
"@Position", [Value],
"@Code", UNICODE(MID ( CurrentText, [Value], 1 ))
)
VAR UpperPositionCode =
FILTER (
PositionCode,
VAR IsUpper =
[@Code] >= UpperMin
&& [@Code] <= UpperMax
&& [@Position] > 1
RETURN
IsUpper
)
VAR Spaces =
SELECTCOLUMNS (
UpperPositionCode,
"@Position", [@Position] - 0.5,
"@Code", SpaceCode
)
VAR NewPositionCode =
UNION ( PositionCode, Spaces )
VAR Result =
CONCATENATEX (
NewPositionCode,
UNICHAR ( [@Code] ),
"",
[@Position]
)
RETURN
Result
The basic idea is to find the uppercase characters in all positions after the first, then insert a space before each of them and reassemble.
Regards
Hey @OwenAuger Thanks. I tried this, however I keep getting an error "DAX comparison pperations do not support comparing values of type Text with values of type integer. Consider using VALUE or FORMAT function to conver one of the values.
Also in addition to the above, I keep seeing an error with [@code], [@position], "cannot find name [@code]"
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
11 | |
9 | |
8 | |
8 |