<?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 Re: The Replacements in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/The-Replacements/m-p/2046358#M748</link>
    <description>&lt;P&gt;I revisited this solution after I remembered my Mythical DAX Index. A perhaps more elegant approach to Text to Table if you don't have | characters in your text is this:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;    VAR __Text = SUBSTITUTE(__SearchText,__Separator,"|")
    VAR __Table = 
        ADDCOLUMNS(
            GENERATESERIES(1,__Count,1),
            "__Word",PATHITEM(__Text,[Value],TEXT)
        )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you did have | characters in your text, you would have to SUBSTITUTE them out and then SUBSTITUTE them back in for each word which could get a little messy.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 13:53:14 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2021-08-30T13:53:14Z</dc:date>
    <item>
      <title>The Replacements</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/The-Replacements/m-p/2008781#M737</link>
      <description>&lt;P data-unlink="true"&gt;This one falls solidly into the "there are better ways to do this" camp. Essentially replace multiple values in a string of text.&lt;/P&gt;
&lt;P data-unlink="true"&gt;Comes from &lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/Substiute-multiple-values-in-a-text-from-another-table/m-p/2008747#M44643" target="_self"&gt;this thread&lt;/A&gt;. This is basically &amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1312929#M594" target="_self"&gt;Text to Table with a different twist.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
    VAR __Separator = "*"
    VAR __SearchText = MAX('Table2'[Column1])
    VAR __Len = LEN(__SearchText)
    VAR __Count = __Len - LEN(SUBSTITUTE(__SearchText,__Separator,"")) + 1
    VAR __Table = 
        ADDCOLUMNS(
            ADDCOLUMNS(
                GENERATESERIES(1,__Count,1),
                "__Word",
                    VAR __Text = SUBSTITUTE(__SearchText,__Separator,"|",IF([Value]=1,1,[Value]-1))
                    VAR __Start =
                        SWITCH(TRUE(),
                            __Count = 1,1,
                            [Value] = 1,1,
                            FIND("|",__Text)+1
                        )
                    VAR __End = 
                        SWITCH(TRUE(),
                            __Count = 1,__Len,
                            [Value] = 1,FIND("|",__Text) - 1,
                            [Value] = __Count,__Len,
                            FIND(__Separator,__Text,__Start)-1
                        )
                    VAR __Word = MID(__Text,__Start,__End - __Start + 1)
                RETURN __Word
            ),
            "__Replaced",LOOKUPVALUE('Table'[Description],'Table'[Code],[__Word])
        )
RETURN
    CONCATENATEX(__Table,[__Replaced],__Separator,[Value])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiN2ZlZDc0MzctMDg5NC00NzM1LTk1OTMtNDdlOTkxZmNhMjg3IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&amp;amp;pageName=ReportSection&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 13:56:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/The-Replacements/m-p/2008781#M737</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-08-11T13:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: The Replacements</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/The-Replacements/m-p/2046358#M748</link>
      <description>&lt;P&gt;I revisited this solution after I remembered my Mythical DAX Index. A perhaps more elegant approach to Text to Table if you don't have | characters in your text is this:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;    VAR __Text = SUBSTITUTE(__SearchText,__Separator,"|")
    VAR __Table = 
        ADDCOLUMNS(
            GENERATESERIES(1,__Count,1),
            "__Word",PATHITEM(__Text,[Value],TEXT)
        )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you did have | characters in your text, you would have to SUBSTITUTE them out and then SUBSTITUTE them back in for each word which could get a little messy.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 13:53:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/The-Replacements/m-p/2046358#M748</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-08-30T13:53:14Z</dc:date>
    </item>
  </channel>
</rss>

