<?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: Very Slow Nested Iterator in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1442692#M26998</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="241776" data-lia-user-login="rks" class="lia-mention lia-mention-user"&gt;rks&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You talk about two tables but your code refers to three: 'Filter Product', 'Filter Parts'&amp;nbsp; and 'Stock'.&amp;nbsp; Can you explain a bit more and show the relationships between the tables (what fields are involved)?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving kudos if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&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;</description>
    <pubDate>Mon, 19 Oct 2020 16:28:46 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2020-10-19T16:28:46Z</dc:date>
    <item>
      <title>Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1441814#M26973</link>
      <description>&lt;P&gt;Hi Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following scenario:&lt;/P&gt;&lt;P&gt;* I have a product table containing 15 million products&lt;/P&gt;&lt;P&gt;* I have a stock table (a billion or so rows) with a relationship to the product&lt;/P&gt;&lt;P&gt;* The stock table also contains other references such as partno, storage location, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, a product could also be a big cupboard consisting of several pieces. Each piece has got a partno and each partno has a quantity.&lt;/P&gt;&lt;P&gt;Let's say I have a wooden-cupboard with 3 parts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Product table: 1 row with attributes such as itemno, description, category and so on&lt;/P&gt;&lt;P&gt;Stock Table: one row per part, aggregated over partno it would look like:&lt;BR /&gt;Partno 1: 5 rows&lt;/P&gt;&lt;P&gt;Partno 2: 5 rows&lt;/P&gt;&lt;P&gt;Partno3: 6 rows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The business wants to know: how many products can I sell given my current stock situation. The answer in this case: I can sell the wooden-cupboard 5 times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have authored a measure which produces the correct results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;SUMX (
                'Filter Product',
                MINX (
                    VALUES ( 'Filter Parts'[PartNo] ),
                    CALCULATE ( COUNTROWS ( 'Stock' ) )
                )
            )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is a number which represents the number of "complete" items on stock.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it's slow, very slow; it runs 2 minutes to produce the results which most of the load in FE ( around 80%). How can I move the payload to SE?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and best regards&lt;/P&gt;&lt;P&gt;Konstantin&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 10:49:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1441814#M26973</guid>
      <dc:creator>rks</dc:creator>
      <dc:date>2020-10-19T10:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1442692#M26998</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="241776" data-lia-user-login="rks" class="lia-mention lia-mention-user"&gt;rks&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You talk about two tables but your code refers to three: 'Filter Product', 'Filter Parts'&amp;nbsp; and 'Stock'.&amp;nbsp; Can you explain a bit more and show the relationships between the tables (what fields are involved)?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving kudos if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&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;</description>
      <pubDate>Mon, 19 Oct 2020 16:28:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1442692#M26998</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-10-19T16:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1442713#M26999</link>
      <description>You should give more details. Especially post a picture of the model itself.</description>
      <pubDate>Mon, 19 Oct 2020 16:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1442713#M26999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-19T16:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446113#M27110</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Thank you for looking into this and the feedback for more details. I have created a quick sample file with this simplified data model:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* Product contains the product's master data with about &lt;STRONG&gt;13 million rows&lt;/STRONG&gt; in the original model&lt;/P&gt;&lt;P&gt;* PartAgg is an aggregated table. In the real scenario each item on stock has a distinctive ID, the model would grow quickly to several hundred million rows in a dimension without aggregating. Of interest is the partNo and one or two other filterable columns. It contains around &lt;STRONG&gt;200 rows.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;* StorageLocation depicts the physical location of each item. The is just to illustrate that there are several other dimensions on a higher grain related to Stock (&lt;STRONG&gt;~5 million rows&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;* Stock is a snapshot once per day with a snapshot date. The fact table contains up to &lt;STRONG&gt;a billion rows&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Download here:&amp;nbsp;&lt;A href="http://s000.tinyupload.com/index.php?file_id=57163484993199174102" target="_blank"&gt;http://s000.tinyupload.com/?file_id=57163484993199174102&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 06:56:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446113#M27110</guid>
      <dc:creator>rks</dc:creator>
      <dc:date>2020-10-21T06:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446156#M27111</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="241776" data-lia-user-login="rks" class="lia-mention lia-mention-user"&gt;rks&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot upload the file here directly. You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like &lt;A href="http://www.tinyupload.com" target="_self"&gt;tinyupload.com&lt;/A&gt; (no sign-up required).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 06:55:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446156#M27111</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-10-21T06:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446733#M27121</link>
      <description>&lt;P&gt;Your formula will be faster if you create an aggregation table that will squeeze the 'Stock' table so that you don't have to count rows for PartNo in CALCULATE ( COUNTROWS ('Stock') ) but use the number of rows directly. So, you'd have a table aggStock which would&amp;nbsp;&lt;SPAN&gt;be created by appropriately agrouping rows and adding one more column that would tell you the number of rows in the grouping (aggStock[PartCount]). Then the measure would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;sumx(
    'Products',
    calculate( minx( 'aggStock'[PartCount] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In aggStock you'd have the same columns as in Stock but it would not be as granular, so that you don't have to count the rows. This is the first speed-up that comes to my mind...&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 10:02:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1446733#M27121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T10:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455710#M27399</link>
      <description>&lt;P&gt;I accept the change in a data model as a solution. Obviously the nested iterator in itself is not to be optimized...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 15:12:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455710#M27399</guid>
      <dc:creator>rks</dc:creator>
      <dc:date>2020-10-26T15:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455873#M27403</link>
      <description>Can you tell us what kind of performance boost you've got from the suggestion? How have the runtimes changed?</description>
      <pubDate>Mon, 26 Oct 2020 16:07:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455873#M27403</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-26T16:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Very Slow Nested Iterator</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455883#M27404</link>
      <description>&lt;P&gt;By the way, you don't have to use MINX. You can do:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;sumx(
    'Products',
    calculate( min( 'aggStock'[PartCount] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;However, under the hood MIN is always MINX:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;min( T[Col] ) = minx( T, T[Col] )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 16:08:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Very-Slow-Nested-Iterator/m-p/1455883#M27404</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-26T16:08:52Z</dc:date>
    </item>
  </channel>
</rss>

