<?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: Text to Table in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1319079#M598</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great post I used a similar approach to answer a problem on the forum, altough it was created as a column (by request of the user) the approach for the measuse is just a small adjustment on the first line using SELECTEDVALUE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Matching-and-returning-a-list-of-all-matching-words-within-a/td-p/1056040/page/2" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/Matching-and-returning-a-list-of-all-matching-words-within-a/td-p/1056040/page/2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are always adding more and more value &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 10:35:08 GMT</pubDate>
    <dc:creator>MFelix</dc:creator>
    <dc:date>2020-08-24T10:35:08Z</dc:date>
    <item>
      <title>Text to Table</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1312929#M594</link>
      <description>&lt;P&gt;OK, these pretty much do what they say. They convert text to a table. There is a version for converting a single word into a table of letters (one letter per row) and one to convert multiple words into a table of words (one word per row). Could be useful...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code for the table conversion is the __Table variable in each of the formulas. The rest of the code is simply some extra stuff to do something interesting with that table.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Text2Table1 Measure = 
    VAR __SearchText = MAX('Table'[SearchText])
    VAR __Vowels = { "a", "e", "i", "o", "u" }
    VAR __Table = SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1,LEN(__SearchText),1),"Letter",MID(__SearchText,[Value],1)),"Letter",[Letter])
    VAR __Intersect = INTERSECT(__Table,__Vowels)
    VAR __CountDistinct = COUNTROWS(DISTINCT(__Intersect))
RETURN
    IF(ISBLANK(__CountDistinct),0,__CountDistinct)



Text2Table2 Measure = 
    VAR __Find = { "when", "given", "then" }
    VAR __SearchText = MAX('Table'[SearchText2])
    VAR __Len = LEN(__SearchText)
    VAR __Count = __Len - LEN(SUBSTITUTE(__SearchText," ","")) + 1
    VAR __Table = 
        SELECTCOLUMNS(
            ADDCOLUMNS(
                GENERATESERIES(1,__Count,1),"Word",
                    VAR __Text = SUBSTITUTE(__SearchText," ","|",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(" ",__Text,__Start)
                        )
                    VAR __Word = MID(__Text,__Start,__End - __Start+1)
                    RETURN __Word
            ),
            "Words",[Word]
        )
    VAR __Intersect = INTERSECT(__Table,__Find)
    VAR __CountDistinct = COUNTROWS(DISTINCT(__Intersect))
RETURN
    IF(ISBLANK(__CountDistinct),0,__CountDistinct)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiNWIxMjBjYzAtNjIwZC00NzUwLWI0NzEtMWZhNjA2MmFhMWIzIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 01:50:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1312929#M594</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-08-21T01:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Text to Table</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1319079#M598</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great post I used a similar approach to answer a problem on the forum, altough it was created as a column (by request of the user) the approach for the measuse is just a small adjustment on the first line using SELECTEDVALUE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Matching-and-returning-a-list-of-all-matching-words-within-a/td-p/1056040/page/2" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/Matching-and-returning-a-list-of-all-matching-words-within-a/td-p/1056040/page/2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are always adding more and more value &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 10:35:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/1319079#M598</guid>
      <dc:creator>MFelix</dc:creator>
      <dc:date>2020-08-24T10:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Text to Table</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/2046353#M745</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:52:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Text-to-Table/m-p/2046353#M745</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-08-30T13:52:36Z</dc:date>
    </item>
  </channel>
</rss>

