<?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: SUMX difficulty: Does not perform as expected in the total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401388#M128441</link>
    <description>&lt;P&gt;This gives me an error&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I found the solution&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 03:13:28 GMT</pubDate>
    <dc:creator>ghaines</dc:creator>
    <dc:date>2023-08-28T03:13:28Z</dc:date>
    <item>
      <title>SUMX difficulty: Does not perform as expected in the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401333#M128439</link>
      <description>&lt;P&gt;I've been having difficulty using SUMX in a particular situation and I've reduced the complexity of the model almost to nothing and I still can't get the expected result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table of fixed exchange rates consolidating to a single currency, and a list of transactions with their currency recorded.&amp;nbsp; You can see they have a different column name for the two, so the use of columns in a visual later is unambiguous:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate the consolidated value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExpensesToCommonCurrency = 
SUMX(VALUES('Exchange Rates FY24'[Local Currency]),
        DIVIDE(SUM(Expenses[transactionamount]) , SELECTEDVALUE('Exchange Rates FY24'[FX]), BLANK())
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which works with 'Exchange Rates FY24' context, but not in aggregate (showing rows with no data):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried changing SELECTEDVALUE to MAX or MIN but in each case it is completely losing the&amp;nbsp;'Exchange Rates FY24' context from the SUMX and just calculating the max or min across the entire XR table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&amp;nbsp; If I switch to SUMX(&lt;SPAN&gt;'Exchange Rates FY24', [Expression]) then I get double the expected value for EUR and CHF, despite the fact that the FX column has no direct relationship with the Expenses table at all.&amp;nbsp; And the aggregate is still blank.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I overlooking?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 02:53:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401333#M128439</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2023-08-28T02:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX difficulty: Does not perform as expected in the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401380#M128440</link>
      <description>&lt;P&gt;Hi Greg&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would just divide the sum of Expenses[transactionamount] by the exchange rates, and the measure amount below is already in converted into EUR amount.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I don't think you need sumx to achieve what you need to do.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 03:08:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401380#M128440</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2023-08-28T03:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX difficulty: Does not perform as expected in the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401388#M128441</link>
      <description>&lt;P&gt;This gives me an error&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I found the solution&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 03:13:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401388#M128441</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2023-08-28T03:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX difficulty: Does not perform as expected in the total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401391#M128442</link>
      <description>&lt;P&gt;Found the solution.&amp;nbsp; In the aggregate, the SUMX context is not passed to sum(transactionamount) unless it is wrapped in a "CALCULATE".&amp;nbsp; I don't know what the context is if you don't wrap it, but this works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExpensesToEUR = 
SUMX(VALUES('Exchange Rates FY24'[FX]),
        DIVIDE(CALCULATE(SUM(Expenses[transactionamount])) , 'Exchange Rates FY24'[FX])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side note, I was struggling with a similar problem where table A filters table B and C, and I need to calculate something using B with a lookup of a value in C.&amp;nbsp; SELECTEDVALUE on Table C was not working within a SUMX.&amp;nbsp; Wrapping it in a CALCULATE is the likely answer.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 03:24:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-difficulty-Does-not-perform-as-expected-in-the-total/m-p/3401391#M128442</guid>
      <dc:creator>ghaines</dc:creator>
      <dc:date>2023-08-28T03:24:19Z</dc:date>
    </item>
  </channel>
</rss>

