<?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 Problem with SUMX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147522#M17366</link>
    <description>&lt;P&gt;I have a couple a problem with a SUMX command that I cannot figure out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First thing I have is another DAX Measure called Latest Estimate Revenue.&amp;nbsp; The details of this command are not overly important, it performs some calculations on different tables, the key point to this is that it relates to a Product table and to a Sold To and a Calendar table all of which are working fine.&amp;nbsp; I can put it in a Matrix visual and drill around these 2 tables and it is working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second I have a table called APF.&amp;nbsp; This table has a few fields AOR2ID, PEID, ProductCategoryID, Date and a Rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to is for each rate in the APF table I want to multiple the Rate * the corresponding Latest Estimate Revenue.&amp;nbsp; The fields AOR2ID and PEID point to a set of Sold Tos and the ProductCategoryID points to a set of products, so what I want to do is get the Latest Estimate Revenue filtered to just this AOR2/PEs and ProductCategories and multiple it times the rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX that I have right now.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;APF = SumX('VF APF Rates',&lt;BR /&gt;'VF APF Rates'[Rate]&lt;BR /&gt;*&lt;BR /&gt;CALCULATE([Planned Cases],&lt;BR /&gt;Filter('Sold To',&lt;BR /&gt;And('Sold To'[Aor2ID] = 'VF APF Rates'[Aor2ID],&lt;BR /&gt;'Sold To'[PEID] = 'VF APF Rates'[PEID]&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;Filter('Product', 'Product'[ProductCategoryID] = 'VF APF Rates'[ProductCategoryID])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This returns nothing.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I remove the Calculate part and put in a hard coded 1 then it returns a value as expected.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I change it to something like what is below where I'm just calculating the Latest Estimate Revenue hard coded to a specific set of values, this returns the value that I would expect as well.&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;APF = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// SumX('VF APF Rates', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// 'VF APF Rates'[Rate] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// * &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([Latest Estimate Revenue], &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Sold To', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And('Sold To'[Aor2ID] = 257,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Sold To'[PEID] = 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Product', 'Product'[ProductCategoryID] = 5)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My understanding of the SumX method is that it would loop over the rows in the VF APF Rate table and perform the calculation for each row.&amp;nbsp; So my second DAX above is half the calculation for 1 specific row and that returns correctly and I know from my other test that the first part of the calculation works fine.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What am I missing and how can I get this to work?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 08 Jun 2020 20:27:02 GMT</pubDate>
    <dc:creator>pcavacas</dc:creator>
    <dc:date>2020-06-08T20:27:02Z</dc:date>
    <item>
      <title>Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147522#M17366</link>
      <description>&lt;P&gt;I have a couple a problem with a SUMX command that I cannot figure out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First thing I have is another DAX Measure called Latest Estimate Revenue.&amp;nbsp; The details of this command are not overly important, it performs some calculations on different tables, the key point to this is that it relates to a Product table and to a Sold To and a Calendar table all of which are working fine.&amp;nbsp; I can put it in a Matrix visual and drill around these 2 tables and it is working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second I have a table called APF.&amp;nbsp; This table has a few fields AOR2ID, PEID, ProductCategoryID, Date and a Rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to is for each rate in the APF table I want to multiple the Rate * the corresponding Latest Estimate Revenue.&amp;nbsp; The fields AOR2ID and PEID point to a set of Sold Tos and the ProductCategoryID points to a set of products, so what I want to do is get the Latest Estimate Revenue filtered to just this AOR2/PEs and ProductCategories and multiple it times the rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX that I have right now.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;APF = SumX('VF APF Rates',&lt;BR /&gt;'VF APF Rates'[Rate]&lt;BR /&gt;*&lt;BR /&gt;CALCULATE([Planned Cases],&lt;BR /&gt;Filter('Sold To',&lt;BR /&gt;And('Sold To'[Aor2ID] = 'VF APF Rates'[Aor2ID],&lt;BR /&gt;'Sold To'[PEID] = 'VF APF Rates'[PEID]&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;Filter('Product', 'Product'[ProductCategoryID] = 'VF APF Rates'[ProductCategoryID])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This returns nothing.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I remove the Calculate part and put in a hard coded 1 then it returns a value as expected.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I change it to something like what is below where I'm just calculating the Latest Estimate Revenue hard coded to a specific set of values, this returns the value that I would expect as well.&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;APF = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// SumX('VF APF Rates', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// 'VF APF Rates'[Rate] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// * &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([Latest Estimate Revenue], &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Sold To', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And('Sold To'[Aor2ID] = 257,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Sold To'[PEID] = 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Product', 'Product'[ProductCategoryID] = 5)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My understanding of the SumX method is that it would loop over the rows in the VF APF Rate table and perform the calculation for each row.&amp;nbsp; So my second DAX above is half the calculation for 1 specific row and that returns correctly and I know from my other test that the first part of the calculation works fine.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What am I missing and how can I get this to work?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Jun 2020 20:27:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147522#M17366</guid>
      <dc:creator>pcavacas</dc:creator>
      <dc:date>2020-06-08T20:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147528#M17367</link>
      <description>&lt;P&gt;It depends on the relationship between the tables and the definition of measures. With each iteration it will use the relationship to perform the measure calculation you defined.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 20:34:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147528#M17367</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-06-08T20:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147540#M17370</link>
      <description>&lt;P&gt;What I want is for it to not take any other filters based on relationships that may exist, instead I want it to calculate the Latest Estimate Revenue based solely on values from the APF Rates table.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 20:43:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147540#M17370</guid>
      <dc:creator>pcavacas</dc:creator>
      <dc:date>2020-06-08T20:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147545#M17371</link>
      <description>&lt;P&gt;Probably requires some explicit summary table to ensure calculatios are done on the right level.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 20:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147545#M17371</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-06-08T20:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147575#M17372</link>
      <description>&lt;P&gt;I got most of it working thanks to the help that you have provided so far, just need help with one final part.&amp;nbsp; What i have now is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;APF = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SumX('VF APF Rates', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'VF APF Rates'[Rate] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;* &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([Latest Estimate Revenue], &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;All(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Sold To', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And('Sold To'[Aor2ID] = 'VF APF Rates'[Aor2ID],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Sold To'[PEID] = 'VF APF Rates'[PEID]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Product', 'Product'[ProductCategoryID] = 'VF APF Rates'[ProductCategoryID]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Filter('Calendar', 'Calendar'[MonthSeqId] = 275)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The problem is with the hard coded MonthSeqId at the end.&amp;nbsp; The problem here is that in the APF Rates table there is only a single date for the month.&amp;nbsp; What need to do is take that 1 day from the APF Rate table and go to the calendar and get the MonthSeqId (which is a field on the Calendar table to denote the fiscal months) and then put that value into the filter, but am having problems writing that.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Jun 2020 21:07:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1147575#M17372</guid>
      <dc:creator>pcavacas</dc:creator>
      <dc:date>2020-06-08T21:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1148051#M17398</link>
      <description>&lt;P&gt;You can try to work with variables and selected value etc.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 05:45:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1148051#M17398</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-06-09T05:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SUMX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1154808#M17636</link>
      <description>&lt;P&gt;Did you manage to get it working? If not, can you share your data model?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 07:23:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-SUMX/m-p/1154808#M17636</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-06-12T07:23:59Z</dc:date>
    </item>
  </channel>
</rss>

