<?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 Is it possible to use SUMX with two tables - different granularity in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2909660#M95054</link>
    <description>&lt;P&gt;Hello all,&lt;BR /&gt;I "think" I need to do some dax in order to calculate total operation time in production, based on total sales from my sales transaction table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have 3 tables (see picture)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The first table include all sales transactions with quantity per item per document invoice. About 10 million rows.&lt;BR /&gt;Each of these item sales is produced out of different material components from table 2.&lt;/P&gt;&lt;P&gt;Table 2 include all material components (in time hours) for each item. About 200.000 rows.&lt;/P&gt;&lt;P&gt;Table 3 is a simple Item table, which can have a one-to-many relationship to both sales transactions and Production time.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would now, for instance, like to show the sum of Setup time and Run time used by each Work Center - which is a field in my production table. I think this calculation needs to be done inside a measure, since creating a fact table (crossjoin sales transaction &amp;amp; Production time) will have too many rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Unfortunately I was not able to create a working DAX formula.&lt;/P&gt;&lt;P&gt;The problem is that I needs to calculate setup (and Run) time for every single sales transactions line (therefore SUMX I assume), but since there is no relationsship between the tables, I have not manage to calculate it correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, the Sum of Run time should be calculated by multiplying Quantity (from sales trans) * Run time (Prod table), and the setup time should be calulacted by multiplying each unique documentNo * Setup Time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible, and do anyone have a solution to my case?&lt;BR /&gt;I have written this post, and think it is kind of the same I need to do:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Get-Help-with-Power-BI/ct-p/PBI_GetHelp" target="_blank"&gt;https://community.powerbi.com/t5/Get-Help-with-Power-BI/ct-p/PBI_GetHelp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&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;Kind regards&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2022 13:45:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-16T13:45:15Z</dc:date>
    <item>
      <title>Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2909660#M95054</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;I "think" I need to do some dax in order to calculate total operation time in production, based on total sales from my sales transaction table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have 3 tables (see picture)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The first table include all sales transactions with quantity per item per document invoice. About 10 million rows.&lt;BR /&gt;Each of these item sales is produced out of different material components from table 2.&lt;/P&gt;&lt;P&gt;Table 2 include all material components (in time hours) for each item. About 200.000 rows.&lt;/P&gt;&lt;P&gt;Table 3 is a simple Item table, which can have a one-to-many relationship to both sales transactions and Production time.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would now, for instance, like to show the sum of Setup time and Run time used by each Work Center - which is a field in my production table. I think this calculation needs to be done inside a measure, since creating a fact table (crossjoin sales transaction &amp;amp; Production time) will have too many rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Unfortunately I was not able to create a working DAX formula.&lt;/P&gt;&lt;P&gt;The problem is that I needs to calculate setup (and Run) time for every single sales transactions line (therefore SUMX I assume), but since there is no relationsship between the tables, I have not manage to calculate it correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, the Sum of Run time should be calculated by multiplying Quantity (from sales trans) * Run time (Prod table), and the setup time should be calulacted by multiplying each unique documentNo * Setup Time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible, and do anyone have a solution to my case?&lt;BR /&gt;I have written this post, and think it is kind of the same I need to do:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Get-Help-with-Power-BI/ct-p/PBI_GetHelp" target="_blank"&gt;https://community.powerbi.com/t5/Get-Help-with-Power-BI/ct-p/PBI_GetHelp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&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;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 13:45:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2909660#M95054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-16T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911305#M95135</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Please follow these steps:&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(1) Create a new measure&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;QUANTITY =

VAR _ITEM = CALCULATETABLE(VALUES('Production time'[Item Name]),'Production time'[Work Center] = MAX('Production time'[Work Center]))

VAR _SALE = SUMX(FILTER(ALL('Sales Transaction'),'Sales Transaction'[Item Name] IN _ITEM ) , 'Sales Transaction'[Quantity])

RETURN _SALE&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(2)Final output&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Best Regards,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Gallen Luo&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&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.&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 03:11:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911305#M95135</guid>
      <dc:creator>v-jialluo-msft</dc:creator>
      <dc:date>2022-11-17T03:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911890#M95173</link>
      <description>&lt;P&gt;Hi Gallen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks - I will give it a try, and mark as accepted if it fix my issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 08:23:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911890#M95173</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-17T08:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911894#M95174</link>
      <description>&lt;P&gt;I have attached a wrong link, to a simular solution.&lt;/P&gt;&lt;P&gt;Below is the correct link:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/td-p/2408887" target="_blank"&gt;https://community.powerbi.com/t5/DAX-Commands-and-Tips/SUMX-over-multiple-tables/td-p/2408887&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 08:24:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2911894#M95174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-17T08:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2913962#M95306</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="462791" data-lia-user-login="v-jialluo-msft" class="lia-mention lia-mention-user"&gt;v-jialluo-msft&lt;/a&gt;&amp;nbsp;Your solution work on my run time, since it is able to calculate the correct amount of quantity for each Work center. However, I cannot get my unique count to work, with the same logic.&lt;/P&gt;&lt;P&gt;I have the following calculation:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Transactions = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _ITEM = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;('D_Item Parent Routing'[Parent Item No_]),'D_Item Parent Routing'[Work Center Global Dimension 1 Code] = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('D_Item Parent Routing'[Work Center Global Dimension 1 Code]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _SALE = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;('F_Sales Transactions','F_Sales Transactions'[No_] &lt;/SPAN&gt;&lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; _ITEM ) , &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;('F_Sales Transactions'[Document No_])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;SPAN&gt; _SALE&lt;BR /&gt;&lt;BR /&gt;But it calculated all rows. Do you have a solution to this problem? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 17 Nov 2022 23:53:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2913962#M95306</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-17T23:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use SUMX with two tables - different granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2914069#M95316</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Hi Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Please follow these steps:&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(1) Create a new measure&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;COUNT = 
VAR _ITEM =
    CALCULATETABLE (
        VALUES ( 'Production time'[Item Name] ),
        'Production time'[Work Center] = MAX ( 'Production time'[Work Center] )
    )
VAR _X =
    CALCULATE (
        DISTINCTCOUNT ( 'Sales Transaction'[Document No] ),
        FILTER ( ALL ( 'Sales Transaction' ), 'Sales Transaction'[Item Name] IN _ITEM )
    )
RETURN
    _X
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(2)Final output&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Best Regards,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Gallen Luo&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&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.&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 01:46:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Is-it-possible-to-use-SUMX-with-two-tables-different-granularity/m-p/2914069#M95316</guid>
      <dc:creator>v-jialluo-msft</dc:creator>
      <dc:date>2022-11-18T01:46:54Z</dc:date>
    </item>
  </channel>
</rss>

