<?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 Using a comma separated column to lookup a value in another unrelated table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3365282#M126537</link>
    <description>&lt;P&gt;Hello. I have one table with comma separated column and I want to look up each value in another unrelated table and if it exists, get the value from a different column in that second table and create a new column in the first table. For example (this is a VERY simplified version of what Im after), I have a table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to take each of the “Sales_Codes” and look for them in the “item_code” column in the table below and if it exists in “item_code”, return the “item_desc”&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the result would look like&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because of the ways the tables are created, there would never be a possibility of an ID being more than one of the “item_desc” values (i.e 453124 would only be “car” and nothing else, but I have to look it up to know that it is “car”). Any help with this would be greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Aug 2023 10:15:15 GMT</pubDate>
    <dc:creator>Craigo</dc:creator>
    <dc:date>2023-08-04T10:15:15Z</dc:date>
    <item>
      <title>Using a comma separated column to lookup a value in another unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3365282#M126537</link>
      <description>&lt;P&gt;Hello. I have one table with comma separated column and I want to look up each value in another unrelated table and if it exists, get the value from a different column in that second table and create a new column in the first table. For example (this is a VERY simplified version of what Im after), I have a table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to take each of the “Sales_Codes” and look for them in the “item_code” column in the table below and if it exists in “item_code”, return the “item_desc”&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the result would look like&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because of the ways the tables are created, there would never be a possibility of an ID being more than one of the “item_desc” values (i.e 453124 would only be “car” and nothing else, but I have to look it up to know that it is “car”). Any help with this would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 10:15:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3365282#M126537</guid>
      <dc:creator>Craigo</dc:creator>
      <dc:date>2023-08-04T10:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using a comma separated column to lookup a value in another unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3367832#M126678</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="598631" data-lia-user-login="Craigo" class="lia-mention lia-mention-user"&gt;Craigo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) My test data is the same as yours.&lt;/P&gt;
&lt;P&gt;(2) We can create calculated columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PATH = SUBSTITUTE([Sales_Code],",","|")&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;PATH_1 = PATHITEM([PATH],1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;PATH_2 = PATHITEM([PATH],2)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;PATH_3 = PATHITEM([PATH],3)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Item_desc = MAXX(FILTER(Table2,CONTAINSSTRING([Item_Code],EARLIER(Table1[PATH_1]))||IF(EARLIER(Table1[PATH_2])&amp;lt;&amp;gt;BLANK(),CONTAINSSTRING([Item_Code],EARLIER(Table1[PATH_2])))||IF(EARLIER(Table1[PATH_3])&amp;lt;&amp;gt;BLANK(),CONTAINSSTRING([Item_Code],EARLIER(Table1[PATH_3])))),[Item_desc])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3) Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 07:35:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3367832#M126678</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-07T07:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using a comma separated column to lookup a value in another unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3367916#M126683</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="598631" data-lia-user-login="Craigo" class="lia-mention lia-mention-user"&gt;Craigo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;There is also such an option:&lt;/P&gt;&lt;P&gt;- split the comma separated lists in the [Item_Code] column of your second table into separate rows using this solution -&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-column-with-comma-delimited-text-split-into-rows-in-a/m-p/1494014;" target="_blank"&gt;https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-column-with-comma-delimited-text-split-into-rows-in-a/m-p/1494014;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- once done, the following calculated column does the rest:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Item_desc = 
MINX ( FILTER ( Ref, CONTAINSSTRING ( [Sales_Code], [Item_Code] ) ), [Item_desc] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;</description>
      <pubDate>Mon, 07 Aug 2023 08:18:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3367916#M126683</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-08-07T08:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a comma separated column to lookup a value in another unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3369193#M126760</link>
      <description>&lt;P&gt;Mate, that works brilliantly. I'll do some more testing with a slightly more complex set of tables, but I think this will work. Thanks very much for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 22:15:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-comma-separated-column-to-lookup-a-value-in-another/m-p/3369193#M126760</guid>
      <dc:creator>Craigo</dc:creator>
      <dc:date>2023-08-07T22:15:21Z</dc:date>
    </item>
  </channel>
</rss>

