<?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: Extract n words from string in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3053313#M105243</link>
    <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 16:57:07 GMT</pubDate>
    <dc:creator>bmk</dc:creator>
    <dc:date>2023-01-31T16:57:07Z</dc:date>
    <item>
      <title>Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047716#M104832</link>
      <description>&lt;P&gt;Hello, I wish to extract certain number of words from the beginning of a sentence based on a delimiter, space character being the most generic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example : "word1 word2 word3 word4 word5"&lt;/P&gt;&lt;P&gt;Output (in case I only need first 2 words) : "word1 word2"&lt;/P&gt;&lt;P&gt;Output (in case I only need first 3 words) : "word1 word2 word3"&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 17:03:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047716#M104832</guid>
      <dc:creator>bmk</dc:creator>
      <dc:date>2023-01-27T17:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047737#M104836</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="330241" data-lia-user-login="bmk" class="lia-mention lia-mention-user"&gt;bmk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to properly understand, when you say select 2 words or 3 words, do you mean select a number from a parameter table?&lt;/P&gt;
&lt;P&gt;and how would you like to disply the rests? In table visual, each record in a row? Or you want to spilit each record into 2 or 3 rows based on the selection? Would you please be more specific and provide more details?&lt;/P&gt;
&lt;P&gt;In general yes this can be done.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 17:20:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047737#M104836</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-27T17:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047892#M104848</link>
      <description>&lt;P&gt;I have a table and I wish to have a calculated column in which the first 3-5 (this is dependent on what the user selects) words of a string is selected.&lt;BR /&gt;&lt;BR /&gt;No further calculations is needed. Example table is below, with first 5 words being extracted in the 'Output' column. Please let me know if this needs to be clarified further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 20:11:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3047892#M104848</guid>
      <dc:creator>bmk</dc:creator>
      <dc:date>2023-01-27T20:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3048767#M104921</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="330241" data-lia-user-login="bmk" class="lia-mention lia-mention-user"&gt;bmk&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Sorry for the the late reply. Please refer to attached sample file, I hope this is what you're looking for.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Output = 
VAR N = MAX ( Selection[Last n Words] )
VAR String = SELECTEDVALUE ( 'Table'[Column] )
VAR Items = SUBSTITUTE ( String, " ", "|" )
VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T1 = GENERATESERIES ( 1, Length, 1 )
VAR T2 = ADDCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
VAR T3 = FILTER ( T2, [Value] &amp;lt;= N )
RETURN
    CONCATENATEX ( T3, [@Item], " ", [Value], ASC )&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 29 Jan 2023 09:51:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3048767#M104921</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-29T09:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3048790#M104922</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="330241" data-lia-user-login="bmk" class="lia-mention lia-mention-user"&gt;bmk&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The following code returns the full text incase there is no selection or if multiple items are selected&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Output = 
VAR String = SELECTEDVALUE ( 'Table'[Column] )
VAR Items = SUBSTITUTE ( String, " ", "|" )
VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
VAR N = SELECTEDVALUE ( Selection[Last n Words], Length )
VAR T1 = GENERATESERIES ( 1, Length, 1 )
VAR T2 = ADDCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
VAR T3 = FILTER ( T2, [Value] &amp;lt;= N )
RETURN
    CONCATENATEX ( T3, [@Item], " ", [Value], ASC )&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 29 Jan 2023 09:55:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3048790#M104922</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-29T09:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extract n words from string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3053313#M105243</link>
      <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 16:57:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-n-words-from-string/m-p/3053313#M105243</guid>
      <dc:creator>bmk</dc:creator>
      <dc:date>2023-01-31T16:57:07Z</dc:date>
    </item>
  </channel>
</rss>

