<?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 how to add a value from another table when a string contains this value? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2824166#M89726</link>
    <description>&lt;P&gt;I need some help to achieve this, hope someone can help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with a column named 'Title'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have another table with a column named 'Code'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to achieve is:&amp;nbsp;&lt;BR /&gt;If table1.Title contains a value that is present in tabl2.Code, I want to see this code in Table1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table1&lt;BR /&gt;&lt;STRONG&gt;CODE&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ABC&lt;/P&gt;&lt;P&gt;DEF&lt;/P&gt;&lt;P&gt;XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2 has a column TITLE, and I want to add a column CODE.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CODE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TITLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DEF&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt; this title contains &lt;STRONG&gt;DEF&lt;/STRONG&gt;, so I want to see this as code&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;this title contains &lt;STRONG&gt;ABC&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this title contains &lt;STRONG&gt;QQQ&lt;/STRONG&gt;. QQQ is not present in table one, so code must stay empty&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;</description>
    <pubDate>Fri, 07 Oct 2022 00:09:23 GMT</pubDate>
    <dc:creator>yyyy</dc:creator>
    <dc:date>2022-10-07T00:09:23Z</dc:date>
    <item>
      <title>how to add a value from another table when a string contains this value?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2824166#M89726</link>
      <description>&lt;P&gt;I need some help to achieve this, hope someone can help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with a column named 'Title'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have another table with a column named 'Code'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to achieve is:&amp;nbsp;&lt;BR /&gt;If table1.Title contains a value that is present in tabl2.Code, I want to see this code in Table1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table1&lt;BR /&gt;&lt;STRONG&gt;CODE&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ABC&lt;/P&gt;&lt;P&gt;DEF&lt;/P&gt;&lt;P&gt;XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2 has a column TITLE, and I want to add a column CODE.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CODE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TITLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DEF&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt; this title contains &lt;STRONG&gt;DEF&lt;/STRONG&gt;, so I want to see this as code&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;this title contains &lt;STRONG&gt;ABC&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this title contains &lt;STRONG&gt;QQQ&lt;/STRONG&gt;. QQQ is not present in table one, so code must stay empty&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;</description>
      <pubDate>Fri, 07 Oct 2022 00:09:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2824166#M89726</guid>
      <dc:creator>yyyy</dc:creator>
      <dc:date>2022-10-07T00:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a value from another table when a string contains this value?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2824225#M89731</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="452887" data-lia-user-login="yyyy" class="lia-mention lia-mention-user"&gt;yyyy&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Seems there is some confusion or typo mistakes in the question. I will assume that Table2 has the column [Title] that is a text which might contain one of codes available in Table1[Code] and you want to create a new column in Table2 that contains the code from Table1 if it existis with the title text otherwise return blank.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Code =
IF (
    NOT ISEMPTY ( FILTER ( Table1, CONTAINSSTRING ( Table2[Title], Table1[Code] ) ) ),
    Table1[Code]
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Oct 2022 01:46:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2824225#M89731</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-10-07T01:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a value from another table when a string contains this value?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2826179#M89860</link>
      <description>&lt;P&gt;I think the provided solution doesn't work:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I used this to test it:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table1&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Table 2&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New calculated column in table 2:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 15:03:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2826179#M89860</guid>
      <dc:creator>EvL1973</dc:creator>
      <dc:date>2022-10-07T15:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a value from another table when a string contains this value?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2826315#M89867</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="353927" data-lia-user-login="EvL1973" class="lia-mention lia-mention-user"&gt;EvL1973&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right. Following is amended&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Code =
VAR T1 =
    FILTER ( Table1, CONTAINSSTRING ( Table2[Title], Table1[Code] ) )
RETURN
    IF ( NOT ISEMPTY ( T1 ), MAXX ( T1, Table1[Code] ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 16:00:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-add-a-value-from-another-table-when-a-string-contains/m-p/2826315#M89867</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-10-07T16:00:33Z</dc:date>
    </item>
  </channel>
</rss>

