<?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 Nested Iterators in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-Iterators/m-p/2629303#M76852</link>
    <description>&lt;P&gt;hello, am having hard time understanding nested iterators&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created one small table with quantities but still am not understanding why am having different results&lt;/P&gt;&lt;P&gt;1. I created regular quantity calculation which is&amp;nbsp;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Table1[quantity]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. I created nested quantity calculation using&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;quantity measure = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;[quantity sumx]&lt;/SPAN&gt;&lt;SPAN&gt;) which is sumx &amp;amp; then my previously created measure quantitysumx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. I created nested quantity calculation using&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Table1[quantity]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;so my question why items 2 &amp;amp; 3 giving different results although both have nested sumx, to my knowledge sumx should iterate row by row, so when i have nested , then for example if i take product a first sumx should be 10+3, then second sumx should be again 13+13 as it is row by row , but when am using measure instead of sumx , its giving different result&lt;/P&gt;&lt;P&gt;i attached below results&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jul 2022 18:07:45 GMT</pubDate>
    <dc:creator>chahineatallah</dc:creator>
    <dc:date>2022-07-10T18:07:45Z</dc:date>
    <item>
      <title>Nested Iterators</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-Iterators/m-p/2629303#M76852</link>
      <description>&lt;P&gt;hello, am having hard time understanding nested iterators&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created one small table with quantities but still am not understanding why am having different results&lt;/P&gt;&lt;P&gt;1. I created regular quantity calculation which is&amp;nbsp;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Table1[quantity]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. I created nested quantity calculation using&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;quantity measure = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;[quantity sumx]&lt;/SPAN&gt;&lt;SPAN&gt;) which is sumx &amp;amp; then my previously created measure quantitysumx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. I created nested quantity calculation using&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Table1[quantity]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;so my question why items 2 &amp;amp; 3 giving different results although both have nested sumx, to my knowledge sumx should iterate row by row, so when i have nested , then for example if i take product a first sumx should be 10+3, then second sumx should be again 13+13 as it is row by row , but when am using measure instead of sumx , its giving different result&lt;/P&gt;&lt;P&gt;i attached below results&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 18:07:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-Iterators/m-p/2629303#M76852</guid>
      <dc:creator>chahineatallah</dc:creator>
      <dc:date>2022-07-10T18:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Iterators</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-Iterators/m-p/2629328#M76856</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="258801" data-lia-user-login="chahineatallah" class="lia-mention lia-mention-user"&gt;chahineatallah&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The reason is context transition. By default all measures are wrapped with CALCULATE forcing context transition. In your case I can tell that products A and B each has two rows while product C has only one row. In the case on nested SUMX and two rows per product&amp;nbsp;the result will be doubled as for each row the inner SUMX will produce the sum of the two rows visible in the current filter context. While when referring to a measure or when wrapping the inner SUMX with CALCULATE then each row or the outer SUMX will be transformed into a filter context that will bring the rows of iteration&amp;nbsp;of the inner SUMX down to only one row.&amp;nbsp;&lt;BR /&gt;This is why when there&amp;nbsp;is only one row per product the result of the two measures is the same.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 19:41:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-Iterators/m-p/2629328#M76856</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-07-10T19:41:49Z</dc:date>
    </item>
  </channel>
</rss>

