<?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 with CALCULATETABLE inside in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3265437#M120874</link>
    <description>&lt;P&gt;CALCULATETABLE is forcing context transition, so the current row essentially becomes the filter context. The filters on Freight and Ship Via then get merged into that context, so you are only seeing values for rows which match the Freight and Ship Via conditions. It is equivalent to writing&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;calculated column =
IF ( Orders[Freight] &amp;gt; 100 &amp;amp;&amp;amp; Orders[ShipVia] = 3, Orders[Freight] )
&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 02 Jun 2023 10:25:47 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-06-02T10:25:47Z</dc:date>
    <item>
      <title>SUMX with CALCULATETABLE inside</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3265351#M120867</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand context transition happens when we have calculate/calculatetable or a named measure inside an interator. For example, if I create a calculated column and enter this formula =CALCULATE(SUMX(Table1, Table1[Field1]*Table1[Field2]) then I know the current row in the calculated column gets passed on as filter when the SUMX scans Table1 and we should see different values in each row in the calculated column.&lt;BR /&gt;&lt;BR /&gt;However, I don't understand what exactly happens when we create a calculate column that contains a CALCULATETABLE inside SUMX? For example, this is my formula inside the calculated column:&lt;BR /&gt;&lt;BR /&gt;calculated column=SUMX(&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Orders&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Orders&lt;/SPAN&gt;&lt;SPAN&gt;[Freight]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Orders&lt;/SPAN&gt;&lt;SPAN&gt;[ShipVia]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Orders[Freight])&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;This formula then creates the below output. As you can see, we have distinct values appearing only in rows where the Freight &amp;gt; 100 and the ShipVia = 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I was expecting to see repeated values in all rows because the SUMX is not wrapped around CALCULATE. For example, when we have something like calculated column = SUMX(Products, Products[Price]*Products[Qty]) we get the same repeated values down the column but if we wrap this formula inside CALCULATE we get a unique value for each row. So the question is, why does my above formula when its not wrapped inside a CALCULATE is still giving distinct values only for when Frieght &amp;gt; 100 and ShipVia=3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You in advance.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 09:24:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3265351#M120867</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2023-06-02T09:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX with CALCULATETABLE inside</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3265437#M120874</link>
      <description>&lt;P&gt;CALCULATETABLE is forcing context transition, so the current row essentially becomes the filter context. The filters on Freight and Ship Via then get merged into that context, so you are only seeing values for rows which match the Freight and Ship Via conditions. It is equivalent to writing&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;calculated column =
IF ( Orders[Freight] &amp;gt; 100 &amp;amp;&amp;amp; Orders[ShipVia] = 3, Orders[Freight] )
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 02 Jun 2023 10:25:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3265437#M120874</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-06-02T10:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX with CALCULATETABLE inside</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3266322#M120930</link>
      <description>&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 20:45:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-with-CALCULATETABLE-inside/m-p/3266322#M120930</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2023-06-02T20:45:23Z</dc:date>
    </item>
  </channel>
</rss>

