<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding space between texts using Uppercase as an indicator of where the space should be in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3413051#M129067</link>
    <description>&lt;P&gt;Hi PowerBI community,&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;For instance: "IronmanMarvelSuperhero" to "Ironman Marvel Superhero"&lt;BR /&gt;&lt;BR /&gt;Is this possible? if it is how do we do this in DAX?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Sep 2023 03:29:43 GMT</pubDate>
    <dc:creator>JuggernautProf</dc:creator>
    <dc:date>2023-09-04T03:29:43Z</dc:date>
    <item>
      <title>Adding space between texts using Uppercase as an indicator of where the space should be</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3413051#M129067</link>
      <description>&lt;P&gt;Hi PowerBI community,&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;For instance: "IronmanMarvelSuperhero" to "Ironman Marvel Superhero"&lt;BR /&gt;&lt;BR /&gt;Is this possible? if it is how do we do this in DAX?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 03:29:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3413051#M129067</guid>
      <dc:creator>JuggernautProf</dc:creator>
      <dc:date>2023-09-04T03:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between texts using Uppercase as an indicator of where the space should be</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3413094#M129070</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="611988" data-lia-user-login="JuggernautProf" class="lia-mention lia-mention-user"&gt;JuggernautProf&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would probably be best handled further upstream, in data source or Power Query.&lt;/P&gt;
&lt;P&gt;However, something like this is possible with DAX.&lt;/P&gt;
&lt;P&gt;Here is the code for a calculated column (PBIX attached):&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;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] &amp;gt;= UpperMin
                &amp;amp;&amp;amp; [@Code] &amp;lt;= UpperMax
                &amp;amp;&amp;amp; [@Position] &amp;gt; 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&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 04:36:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3413094#M129070</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-09-04T04:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between texts using Uppercase as an indicator of where the space should be</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3414626#M129167</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;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.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also in addition to the above, I keep seeing an error with [@code], [@position], "cannot find name [@code]"&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 00:50:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3414626#M129167</guid>
      <dc:creator>JuggernautProf</dc:creator>
      <dc:date>2023-09-05T00:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between texts using Uppercase as an indicator of where the space should be</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3414665#M129170</link>
      <description>&lt;P&gt;Hey again &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="611988" data-lia-user-login="JuggernautProf" class="lia-mention lia-mention-user"&gt;JuggernautProf&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 &lt;STRONG&gt;'Text'[Text]&lt;/STRONG&gt; at the start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing we may need to consider is handling of blank/empty strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 01:32:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/3414665#M129170</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-09-05T01:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding space between texts using Uppercase as an indicator of where the space should be</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/4238822#M167693</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;, the solution works perfectly!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 12:47:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-space-between-texts-using-Uppercase-as-an-indicator-of/m-p/4238822#M167693</guid>
      <dc:creator>Oleh116611</dc:creator>
      <dc:date>2024-10-11T12:47:44Z</dc:date>
    </item>
  </channel>
</rss>

