<?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 Find multiple substring (not defined a priori) in a text in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451287#M131476</link>
    <description>&lt;P&gt;Hello everyone, I'm new to this forum and also to using Power BI Desktop. I was trying to solve a small issue I'm encountering.&lt;/P&gt;&lt;P&gt;In practice, I need to be able to find words within a text contained in a row, let me explain it better. In a cell in column A, I have the string "A,B,C". In the cell in column B, I have the string "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;So, I need to check if "A", "B", and "C" are in "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;Similarly, if I have the string "C,B", I need to be able to check if "C" and "B" are in "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;The strings in the cells of columns A and B do not have a fixed number of elements; they can vary.&lt;BR /&gt;&lt;BR /&gt;The results is better explained here:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Column A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Column B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Results&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;TD&gt;A,B,C,D,E,F,G,H,I&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C,B&lt;/TD&gt;&lt;TD&gt;A,B,C,D,E,F,G,I,N,P,Z&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D,Z&lt;/TD&gt;&lt;TD&gt;A,B,C,I,Z&lt;/TD&gt;&lt;TD&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Thanks to everyone who will help me&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2023 08:06:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-28T08:06:12Z</dc:date>
    <item>
      <title>Find multiple substring (not defined a priori) in a text</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451287#M131476</link>
      <description>&lt;P&gt;Hello everyone, I'm new to this forum and also to using Power BI Desktop. I was trying to solve a small issue I'm encountering.&lt;/P&gt;&lt;P&gt;In practice, I need to be able to find words within a text contained in a row, let me explain it better. In a cell in column A, I have the string "A,B,C". In the cell in column B, I have the string "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;So, I need to check if "A", "B", and "C" are in "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;Similarly, if I have the string "C,B", I need to be able to check if "C" and "B" are in "A,B,C,D,E,F,G,H,I".&lt;/P&gt;&lt;P&gt;The strings in the cells of columns A and B do not have a fixed number of elements; they can vary.&lt;BR /&gt;&lt;BR /&gt;The results is better explained here:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Column A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Column B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Results&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;TD&gt;A,B,C,D,E,F,G,H,I&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C,B&lt;/TD&gt;&lt;TD&gt;A,B,C,D,E,F,G,I,N,P,Z&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D,Z&lt;/TD&gt;&lt;TD&gt;A,B,C,I,Z&lt;/TD&gt;&lt;TD&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Thanks to everyone who will help me&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 08:06:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451287#M131476</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-28T08:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Find multiple substring (not defined a priori) in a text</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451443#M131489</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You can follow steps in Power Query Editor,&lt;BR /&gt;&lt;BR /&gt;1. Create a custom column to create list for Column A by separating text using delimitor.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Text.Split([#"Column A"], ",")&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Create a custom column to create a list for Column B by separating text using a delimiter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Text.Split([#"Column B"], ",")&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;3. Now to compare values from both list create another custom column with below expression,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List.Accumulate(List.Positions([ColumnASplit]), true, (a,b) =&amp;gt; a and ([ColumnASplit]{b} = [ColumnBSplit]{b}))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This will result as follows:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inogic Professional Services Division&lt;/P&gt;&lt;P&gt;Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!&lt;/P&gt;&lt;P&gt;Drop an email at &lt;A href="mailto:crm@inogic.com" target="_blank" rel="noopener"&gt;crm@inogic.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Services:&amp;nbsp; &lt;A href="http://www.inogic.com/services/" target="_blank" rel="noopener"&gt;http://www.inogic.com/services/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM Tips and Tricks:&amp;nbsp; &lt;A href="http://www.inogic.com/blog/" target="_blank" rel="noopener"&gt;http://www.inogic.com/blog/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 09:51:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451443#M131489</guid>
      <dc:creator>SamInogic</dc:creator>
      <dc:date>2023-09-28T09:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find multiple substring (not defined a priori) in a text</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451458#M131490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/P&gt;&lt;P&gt;In addition to the Power Query solution proposed by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="480849" data-lia-user-login="SamInogic" class="lia-mention lia-mention-user"&gt;SamInogic&lt;/a&gt;, here is a DAX one:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And in plain text for convenience:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Calculated Column = 
VAR qty = LEN ( [Column A] ) - LEN ( SUBSTITUTE ( [Column A], ",", "" ) ) + 1
VAR tbl1 = GENERATESERIES ( 1, qty, 1 )
VAR tbl2 = ADDCOLUMNS ( tbl1, "Item", PATHITEM ( SUBSTITUTE ( [Column A], ",", "|" ), [Value] ) )
VAR tbl3 = ADDCOLUMNS ( tbl2, "Flag", INT ( NOT CONTAINSSTRING ( [Column B], [Item] ) ) )
RETURN IF ( SUMX ( tbl3, [Flag] ) &amp;gt; 0, FALSE (), TRUE () )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 10:00:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451458#M131490</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-09-28T10:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find multiple substring (not defined a priori) in a text</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451471#M131492</link>
      <description>&lt;P&gt;And in case i have to perform the control of each row of A to all the rows of B?&lt;BR /&gt;Like check A,B,C if it is contained into&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;A,B,C,D,E,F,G,H,I into&amp;nbsp;A,B,C,D,E,F,G,I,N,P,Z and into&amp;nbsp;A,B,C,I,Z returning the id associated?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;A,B,C,D,E,F,G,H,I&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;1,2,3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;C,B&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;A,B,C,D,E,F,G,I,N,P,Z&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;1,2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;D,Z&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;A,B,C,I,Z&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Sorry for the replay that complicate the argument &lt;/SPAN&gt;&lt;SPAN&gt;=(&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 10:11:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451471#M131492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-28T10:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find multiple substring (not defined a priori) in a text</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451644#M131506</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;In this case, the calculated column should look like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And in plain text:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Calculated Column = 
VAR tbl1 = SELECTCOLUMNS ( Data2, "ID", [ID], "Col B", [Column B] )
VAR qty = LEN ( [Column A] ) - LEN ( SUBSTITUTE ( [Column A], ",", "" ) ) + 1
VAR tbl2 = GENERATESERIES ( 1, qty, 1 )
VAR tbl3 = ADDCOLUMNS ( tbl2, "Item", PATHITEM ( SUBSTITUTE ( [Column A], ",", "|" ), [Value] ) )
VAR tbl4 = CROSSJOIN ( tbl3, tbl1 )
VAR tbl5 = ADDCOLUMNS ( tbl4, "Flag", INT ( CONTAINSSTRING ( [Col B], [Item] ) ) )
VAR tbl6 = SUMMARIZE ( tbl5, [ID], "Cnt",
                       VAR CurrentID = [ID]
                       RETURN SUMX ( FILTER ( tbl5, [ID] = CurrentID ), [Flag] ) )
VAR tbl7 = FILTER ( tbl6, [Cnt] = qty )
RETURN CONCATENATEX ( tbl7, [ID], "," ) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 12:20:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-multiple-substring-not-defined-a-priori-in-a-text/m-p/3451644#M131506</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-09-28T12:20:51Z</dc:date>
    </item>
  </channel>
</rss>

