<?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 DAX/PowerQuery Check if value is contained in 1-N list of values in another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3832869#M149882</link>
    <description>&lt;P&gt;Good morning all!&lt;/P&gt;&lt;P&gt;I would like to know the best way to deal with this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to check for each value (ID_TASK_ORDER) in table A (ID-ID) , if it is contained in any posible combination in table B (ID- {List of ID's})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of firstly Summarizing tabla B and then relate this new table and table A.&lt;/P&gt;&lt;P&gt;Do you think this is the way to solve the problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I create with DAX the summary table with all distinct values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&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, 12 Apr 2024 07:21:24 GMT</pubDate>
    <dc:creator>sashaxiv</dc:creator>
    <dc:date>2024-04-12T07:21:24Z</dc:date>
    <item>
      <title>DAX/PowerQuery Check if value is contained in 1-N list of values in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3832869#M149882</link>
      <description>&lt;P&gt;Good morning all!&lt;/P&gt;&lt;P&gt;I would like to know the best way to deal with this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to check for each value (ID_TASK_ORDER) in table A (ID-ID) , if it is contained in any posible combination in table B (ID- {List of ID's})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of firstly Summarizing tabla B and then relate this new table and table A.&lt;/P&gt;&lt;P&gt;Do you think this is the way to solve the problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I create with DAX the summary table with all distinct values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&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, 12 Apr 2024 07:21:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3832869#M149882</guid>
      <dc:creator>sashaxiv</dc:creator>
      <dc:date>2024-04-12T07:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX/PowerQuery Check if value is contained in 1-N list of values in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3833781#M149901</link>
      <description>&lt;P&gt;Unpivot table B to bring it into a usable format. Then you can join directly via your key.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 11:53:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3833781#M149901</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-04-12T11:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: DAX/PowerQuery Check if value is contained in 1-N list of values in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3833931#M149904</link>
      <description>&lt;P&gt;Yes, but I could have a problem.&lt;/P&gt;&lt;P&gt;Column Order in table B may have 1 to N different values (the table will be connected to an Excel file). If I unpivot table B with powerquery, let's imagine that the first time N=4 (orders A,B,C,D), but a couple of days the file contains 5 orders in a file N=5 (orders A...E).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the table is updated I will be missing order E&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 12:29:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3833931#M149904</guid>
      <dc:creator>sashaxiv</dc:creator>
      <dc:date>2024-04-12T12:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: DAX/PowerQuery Check if value is contained in 1-N list of values in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3834159#M149909</link>
      <description>&lt;P&gt;Unpivot it as part of your Power Query script, so it always operates on the latest data.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 13:17:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3834159#M149909</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-04-12T13:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: DAX/PowerQuery Check if value is contained in 1-N list of values in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3837050#M150015</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="219728" data-lia-user-login="sashaxiv" class="lia-mention lia-mention-user"&gt;sashaxiv&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp; for the quick reply. I have some other thoughts to add:&lt;/P&gt;
&lt;P&gt;(1) In power query, copy a table B. Click "Advanced Editor" to copy and paste the following code.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUap21HGqVYrVgfOcITwjIM8VzDIGstyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID_TASK = _t, ORDERS = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID_TASK", Int64.Type}, {"ORDERS", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "ORDERS", Splitter.SplitTextByDelimiter("{", QuoteStyle.Csv), {"ORDERS.1", "ORDERS.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"ORDERS.1", type text}, {"ORDERS.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "ORDERS.2", Splitter.SplitTextByDelimiter("}", QuoteStyle.Csv), {"ORDERS.2.1", "ORDERS.2.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"ORDERS.2.1", type text}, {"ORDERS.2.2", type text}}),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type2",{"ORDERS.1", "ORDERS.2.1", "ORDERS.2.2"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged"),
    #"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Merged", "ORDERS"}}),
    #"Split Column by Delimiter2" = Table.ExpandListColumn(Table.TransformColumns(#"Renamed Columns", {{"ORDERS", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "ORDERS"),
    #"Removed Duplicates" = Table.Distinct(#"Split Column by Delimiter2", {"ORDERS"})
in
    #"Removed Duplicates"&lt;/LI-CODE&gt;
&lt;P&gt;Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;We can create a table in desktop.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table C = SUMMARIZE('Table B (2)','Table B (2)'[ID_TASK],"ORDERS",CONCATENATEX ( 'Table B (2)' , [ORDERS] , ","))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;We can create a column in Table A.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IS_A_IN_B = 
var _table= SELECTCOLUMNS(ADDCOLUMNS('Table B (2)',"task_order",[ID_TASK] &amp;amp;"-" &amp;amp; [ORDERS]),"i_t_o",[task_order])
RETURN IF([ID_TASK_ORDER] in _table,1,0)&lt;/LI-CODE&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;&lt;EM&gt;helps&lt;/EM&gt;&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;
&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>Mon, 15 Apr 2024 06:24:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-PowerQuery-Check-if-value-is-contained-in-1-N-list-of-values/m-p/3837050#M150015</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-15T06:24:21Z</dc:date>
    </item>
  </channel>
</rss>

