<?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 - Select as RIGHT OUTER JOIN in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Select-as-RIGHT-OUTER-JOIN/m-p/1005241#M12791</link>
    <description>&lt;P&gt;Morning all!&lt;/P&gt;&lt;P&gt;I would like to solve a problem with DAX. My requirements are as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have a TABLE A with Sku, Store, FamilySku&amp;nbsp; (store stocks): sk1 - store1 - fam1 ; sk2 - store1 - fam1&lt;/LI&gt;&lt;LI&gt;I have a TABLE B with Sku, FamilySku, Rank&amp;nbsp; (warehouse stock): sk1 - fam1 - 1; sku51 - fam1 - 2;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each row in table A I would like to create two new columns:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;First Sku of the same family in Table B that is not in table A&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Second Sku of the same family in Table B that is not in table A&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;In SQL it would be something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select Sku from&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;tableA a Right outer join TableB b&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;On...&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Where A.store = "X" and B.Rank = 1 &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Any ideas to start with?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thank in you in advance!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Regards&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 15:59:35 GMT</pubDate>
    <dc:creator>sashaxiv</dc:creator>
    <dc:date>2020-04-02T15:59:35Z</dc:date>
    <item>
      <title>DAX - Select as RIGHT OUTER JOIN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Select-as-RIGHT-OUTER-JOIN/m-p/1005241#M12791</link>
      <description>&lt;P&gt;Morning all!&lt;/P&gt;&lt;P&gt;I would like to solve a problem with DAX. My requirements are as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have a TABLE A with Sku, Store, FamilySku&amp;nbsp; (store stocks): sk1 - store1 - fam1 ; sk2 - store1 - fam1&lt;/LI&gt;&lt;LI&gt;I have a TABLE B with Sku, FamilySku, Rank&amp;nbsp; (warehouse stock): sk1 - fam1 - 1; sku51 - fam1 - 2;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each row in table A I would like to create two new columns:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;First Sku of the same family in Table B that is not in table A&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Second Sku of the same family in Table B that is not in table A&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;In SQL it would be something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select Sku from&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;tableA a Right outer join TableB b&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;On...&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Where A.store = "X" and B.Rank = 1 &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Any ideas to start with?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thank in you in advance!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Regards&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 15:59:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Select-as-RIGHT-OUTER-JOIN/m-p/1005241#M12791</guid>
      <dc:creator>sashaxiv</dc:creator>
      <dc:date>2020-04-02T15:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - Select as RIGHT OUTER JOIN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Select-as-RIGHT-OUTER-JOIN/m-p/3412702#M129032</link>
      <description>&lt;P&gt;You're essentially trying to perform a right outer join in DAX, which isn't as straightforward as SQL, but it's doable.&lt;/P&gt;
&lt;P&gt;To achieve this, you can use the RELATEDTABLE and EXCEPT functions in DAX. Here's a rough idea of how you can approach this:&lt;/P&gt;
&lt;P&gt;First, let's create a new table that filters TABLE B based on the FamilySku from TABLE A and excludes SKUs that are already in TABLE A:&lt;/P&gt;
&lt;P&gt;FilteredTableB = &lt;BR /&gt;VAR CurrentFamilySku = SELECTEDVALUE('TABLE A'[FamilySku])&lt;BR /&gt;RETURN&lt;BR /&gt;FILTER(&lt;BR /&gt;EXCEPT(&lt;BR /&gt;FILTER('TABLE B', 'TABLE B'[FamilySku] = CurrentFamilySku),&lt;BR /&gt;FILTER('TABLE A', 'TABLE A'[FamilySku] = CurrentFamilySku)&lt;BR /&gt;),&lt;BR /&gt;'TABLE B'[Rank] &amp;lt;= 2&lt;BR /&gt;)&lt;BR /&gt;Now, let's create the two new columns in TABLE A:&lt;/P&gt;
&lt;P&gt;For the first SKU:&lt;/P&gt;
&lt;P&gt;FirstSKU = &lt;BR /&gt;VAR FilteredRows = FilteredTableB&lt;BR /&gt;RETURN&lt;BR /&gt;MINX(FILTER(FilteredRows, 'TABLE B'[Rank] = 1), 'TABLE B'[Sku])&lt;BR /&gt;For the second SKU:&lt;/P&gt;
&lt;P&gt;SecondSKU = &lt;BR /&gt;VAR FilteredRows = FilteredTableB&lt;BR /&gt;RETURN&lt;BR /&gt;MINX(FILTER(FilteredRows, 'TABLE B'[Rank] = 2), 'TABLE B'[Sku])&lt;BR /&gt;These columns will give you the first and second SKUs from TABLE B that are not in TABLE A for the same FamilySku.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2023 17:22:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Select-as-RIGHT-OUTER-JOIN/m-p/3412702#M129032</guid>
      <dc:creator>technolog</dc:creator>
      <dc:date>2023-09-03T17:22:24Z</dc:date>
    </item>
  </channel>
</rss>

