<?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 Re: Calculating unique combination from different tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796908#M183564</link>
    <description>&lt;P&gt;Thanks, that did the trick!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Aug 2025 10:13:36 GMT</pubDate>
    <dc:creator>Nicpet0</dc:creator>
    <dc:date>2025-08-14T10:13:36Z</dc:date>
    <item>
      <title>Calculating unique combination from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796775#M183559</link>
      <description>&lt;P&gt;Hi Community&lt;BR /&gt;&lt;BR /&gt;I am facing an issue in Power Bi with a DAX measure i am trying to create. (See below the pasted code, as it looks currently)&lt;BR /&gt;&lt;BR /&gt;I am trying to count each occurence of the unique combination of [Variant Item No], [Variant Code] and [Sales Person Name] whenever there as a sale where the Gross Margin % is negative. The first to mentioned fields comes from the same table 'Variant' while Sales Person comes from its own table. They are indirect linked through a 'Sales' table.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What i am looking for is the most memory efficient DAX code that can achieve what i described above. Whenever i just have the combination of Variant Item No and Variant Code it runs fine, but it is when i also want to combine a field from another table where it becomes increasingly more taxing for it to run.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any advide is helpful, thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count of Negative Margin =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt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/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;Groups&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;[Gross Margin 2 %]&lt;/SPAN&gt;&lt;SPAN&gt; ) &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Aug 2025 08:02:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796775#M183559</guid>
      <dc:creator>Nicpet0</dc:creator>
      <dc:date>2025-08-14T08:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating unique combination from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796805#M183560</link>
      <description>&lt;P&gt;I think your code just needs a little tweak&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count of Negative Margin =
VAR Groups =
    SUMMARIZECOLUMNS (
        'Variant'[Variant Item No],
        'Variant'[Variant Code],
        'Sales Person'[Sales Person Name],
        "@gross margin", [Gross Margin 2 %]
    )
RETURN
    COUNTROWS ( FILTER ( Groups, [@gross margin] &amp;lt; 0 ) )
&lt;/LI-CODE&gt;
&lt;P&gt;By including the measure in the SUMMARIZECOLUMNS you will only return combinations of item no, code and sales person which have made sales, rather than all possible combinations which your original code would do. You can then filter that for values below 0.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 08:28:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796805#M183560</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-08-14T08:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating unique combination from different tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796908#M183564</link>
      <description>&lt;P&gt;Thanks, that did the trick!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 10:13:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-unique-combination-from-different-tables/m-p/4796908#M183564</guid>
      <dc:creator>Nicpet0</dc:creator>
      <dc:date>2025-08-14T10:13:36Z</dc:date>
    </item>
  </channel>
</rss>

