<?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 SUM for 2 tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861089#M6959</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm&amp;nbsp;a newbie&amp;nbsp;and trying to sum up Headcount from 2 different tables:&lt;/P&gt;&lt;P&gt;1. Country Main : this is the main database that contains headcount for all countries, by month&lt;/P&gt;&lt;P&gt;2. Country A : monthly headcount data specific to Country A&lt;/P&gt;&lt;P&gt;and getting to a monthly Total Headcount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to create a measure: Total Headcount, but it's not adding up correctly - headcount for&lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt; all &lt;/FONT&gt;&lt;/STRONG&gt;countries are inflated by Country A's &lt;STRONG&gt;Total&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't&amp;nbsp;append the tables&amp;nbsp;and need to use&amp;nbsp;DAX. Could somone give me a hand here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find&amp;nbsp;PBI file &lt;A href="https://drive.google.com/file/d/1msI2eEd14yuw0UGLbO_CuxGB20fea124/view?usp=sharing" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Sat, 30 Nov 2019 03:36:42 GMT</pubDate>
    <dc:creator>TSI</dc:creator>
    <dc:date>2019-11-30T03:36:42Z</dc:date>
    <item>
      <title>SUM for 2 tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861089#M6959</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm&amp;nbsp;a newbie&amp;nbsp;and trying to sum up Headcount from 2 different tables:&lt;/P&gt;&lt;P&gt;1. Country Main : this is the main database that contains headcount for all countries, by month&lt;/P&gt;&lt;P&gt;2. Country A : monthly headcount data specific to Country A&lt;/P&gt;&lt;P&gt;and getting to a monthly Total Headcount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to create a measure: Total Headcount, but it's not adding up correctly - headcount for&lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt; all &lt;/FONT&gt;&lt;/STRONG&gt;countries are inflated by Country A's &lt;STRONG&gt;Total&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't&amp;nbsp;append the tables&amp;nbsp;and need to use&amp;nbsp;DAX. Could somone give me a hand here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find&amp;nbsp;PBI file &lt;A href="https://drive.google.com/file/d/1msI2eEd14yuw0UGLbO_CuxGB20fea124/view?usp=sharing" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 03:36:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861089#M6959</guid>
      <dc:creator>TSI</dc:creator>
      <dc:date>2019-11-30T03:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: SUM for 2 tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861117#M6960</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="140970" data-lia-user-login="TSI" class="lia-mention lia-mention-user"&gt;TSI&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Headcount = sumx('Country Main';'Country Main'[Headcount]) + 
lookupvalue('Country A Monthly'[Headcount];'Country A Monthly'[Month];selectedvalue('Country Main'[Month]);'Country A Monthly'[Country];SELECTEDVALUE('Country Main'[Country])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, it won't calulate total of 'Total Headcount' correctly&lt;/P&gt;&lt;P&gt;in my opinion, for your data model would be better to create key columns in both tables, like this for 'Country Main'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ColumnKey = concatenate('Country Main'[Country];'Country Main'[Month])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; and for&amp;nbsp;'Country A Monthly'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ColumnKey = concatenate('Country A Monthly'[Country];'Country A Monthly'[Month])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then create one-to-one relationships between tables via ColumnKey&lt;/P&gt;&lt;P&gt;and then in Country Main table create new column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = 'Country Main'[Headcount]+related('Country A Monthly'[Headcount])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to kudo useful posts and mark solutions as solution&lt;BR /&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;A href="http://www.linkedin.com/in/alekseizhukov" target="_blank" rel="noopener"&gt;Linkedin&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 08:11:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861117#M6960</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2019-11-30T08:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: SUM for 2 tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861131#M6962</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sum by Market worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The extra solution you gave of creating a key column in both tables is brilliant -&amp;nbsp;you went the extra mile&amp;nbsp;after noticing&amp;nbsp;that the Total didn't add up correctly even when sum by Market did.&amp;nbsp; Being new to DAX, I really appreciated the detailed steps and clear explanation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 11:00:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-for-2-tables/m-p/861131#M6962</guid>
      <dc:creator>TSI</dc:creator>
      <dc:date>2019-11-30T11:00:19Z</dc:date>
    </item>
  </channel>
</rss>

