<?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: Understanding Context Transition with Table Filter Arguments in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1973783#M43409</link>
    <description>&lt;P&gt;SUMX is always an iterator. To really trouble shoot this you'd need to analyze the query plan in DAX Studio to see what the engine is doing. That will show you the exact pseudo-SQL being generated for each query and how they differ.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 16:06:11 GMT</pubDate>
    <dc:creator>edhans</dc:creator>
    <dc:date>2021-07-22T16:06:11Z</dc:date>
    <item>
      <title>Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969127#M43216</link>
      <description>&lt;P&gt;As a follow-up to&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Different-level-hierarchy-ranking-with-a-visual-filter-applied/m-p/1966573" target="_self"&gt;this post&lt;/A&gt;, I've created a simpler example that demonstrates the core of the behavior I still don't quite understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Consider the following table, 'Data':&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Data = DATATABLE ( "group", STRING, "amount", INTEGER, { {"A", 5}, {"A", 10}, {"B", 12}, {"C", 15} } )&lt;/LI-CODE&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;I'd like to understand why the following do not give the same result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMMARIZECOLUMNS (
    Data[group],
    "Rank", RANKX ( ALL ( Data[group] ), CALCULATE ( SUM ( Data[amount] ) ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;versus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMMARIZECOLUMNS (
    Data[group],
    Data,
    "Rank", RANKX ( ALL ( Data[group] ), CALCULATE ( SUM ( Data[amount] ) ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first gives A,B,C with Rank 2,3,1 respectively, whereas the second gives Rank 1,1,1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, the following also return different results (which match the results above):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ADDCOLUMNS (
    VALUES ( Data[group] ),
    "Rank",
        CALCULATE (
            RANKX ( ALL ( Data[group] ), CALCULATE ( SUM ( Data[amount] ) ) )
        )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;versus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ADDCOLUMNS (
    VALUES ( Data[group] ),
    "Rank",
        CALCULATE (
            RANKX ( ALL ( Data[group] ), CALCULATE ( SUM ( Data[amount] ) ) ),
            Data
        )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curiously, if I replace &lt;STRONG&gt;RANKX&lt;/STRONG&gt; with &lt;STRONG&gt;SUMX&lt;/STRONG&gt; in the &lt;STRONG&gt;ADDCOLUMNS&lt;/STRONG&gt; pair of expressions, the results match each other (both give A,B,C with Rank 47,47,47) whereas the &lt;STRONG&gt;SUMMARIZECOLUMNS&lt;/STRONG&gt; pair gives A,B,C with Rank 47,47,47 for the first expression but Rank 15,12,20 for the second one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These examples are a bit contrived but I'm looking to understand exactly &lt;EM&gt;why&lt;/EM&gt; these behave the way they do and this was the most simplified form I could come up with. They may look slightly less odd if you replace &lt;STRONG&gt;CALCULATE ( SUM ( Data[amount] ) )&lt;/STRONG&gt; with a&amp;nbsp; measure &lt;STRONG&gt;[SumAmount] :=&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;SUM ( Data[amount] )&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's going on here? How is the table argument getting applied in these cases?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 20:39:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969127#M43216</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-07-20T20:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969261#M43220</link>
      <description>&lt;P&gt;I believe this is Auto-Exist kicking in. SUMMARIZECOLUMNS combines all filters from the same table into one filter, so in your second evaluation, you have DATA, and DATA[Group] - and they get combined since it is the same table.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Take a look at the &lt;A href="https://dax.guide/summarizecolumns/" target="_self"&gt;detailed explanation of SUMMARIZECOLUMNS() here&lt;/A&gt;&amp;nbsp;and then the &lt;A href="https://www.sqlbi.com/articles/understanding-dax-auto-exist/" target="_self"&gt;Auto-Exist issue you may need to contend with here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Auto-exist is a pain to recon with.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 22:59:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969261#M43220</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2021-07-20T22:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969532#M43224</link>
      <description>&lt;P&gt;can this help you?&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;think you can get more from here&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/all-the-secrets-of-summarize/" target="_blank"&gt;https://www.sqlbi.com/articles/all-the-secrets-of-summarize/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 03:55:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1969532#M43224</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2021-07-21T03:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1970711#M43280</link>
      <description>&lt;P&gt;Thanks. Auto-Exists does seem like the likely explanation, at least for the SUMMARIZECOLUMNS cases since using a dimension table for group resolves the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the ADDCOLUMNS examples, using a dimension table doesn't seem to help so maybe there's something else happening. Auto-Exists also doesn't explain why RANKX and SUMX behave differently for these.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 14:25:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1970711#M43280</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-07-21T14:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1970872#M43288</link>
      <description>&lt;P&gt;I'm certianly not an expert in Auto-Exists, but I believe it returns a table with specific info, therefore SUMX and RANKX are operating on a different result set than the SUMMARIZECOLUMNS without the filter table. That is why you are getting different results. &lt;A href="https://www.youtube.com/watch?v=aRntX-HiiN8&amp;amp;list=PLU6II7MW-aiKE4pDpvMn5KWANKvf0Be9-&amp;amp;index=7" target="_self"&gt;SQLBI does a deep dive into Auto Exist in this video&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;If you could mark one or more of these as the solution so this thread can be marked solved, we'd appreciate it.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 15:31:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1970872#M43288</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2021-07-21T15:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1973614#M43401</link>
      <description>&lt;P&gt;Why would SUMX operate on a different result set than RANKX in the ADDCOLUMNS examples (where the results match each other using SUMX but don't match using RANKX)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My only guess would be that there might be some kind of internal optimization such that SUMX isn't actually behaving as an iterator whereas RANKX still must.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 14:47:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1973614#M43401</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-07-22T14:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Context Transition with Table Filter Arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1973783#M43409</link>
      <description>&lt;P&gt;SUMX is always an iterator. To really trouble shoot this you'd need to analyze the query plan in DAX Studio to see what the engine is doing. That will show you the exact pseudo-SQL being generated for each query and how they differ.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 16:06:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Understanding-Context-Transition-with-Table-Filter-Arguments/m-p/1973783#M43409</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2021-07-22T16:06:11Z</dc:date>
    </item>
  </channel>
</rss>

