<?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 Slow paginated report - The connection either timed out or was lost. Pareto Analysis in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Slow-paginated-report-The-connection-either-timed-out-or-was/m-p/4605762#M59801</link>
    <description>&lt;P&gt;I have a dataset in a Paginated Report that runs slowly because it includes a Pareto analysis of products on a table with around 200,000 rows. When I analyze its DAX query, it takes approximately 10 minutes to execute. Of course, this is not an ideal execution time, but it is what it is.&lt;/P&gt;&lt;P&gt;The problem is that in the Paginated Report, even when I run the report with filters on the product table, it is unable to generate at all. I receive the following error:&lt;BR /&gt;&lt;STRONG&gt;"The connection either timed out or was lost. Query execution failed for dataset 'XXX'."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is there anything I can do about this, or do I just have to keep optimizing the dataset's code?&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;P&gt;DEFINE&lt;BR /&gt;VAR _TotalSales =&lt;BR /&gt;CALCULATE ( [Sales $], ALLSELECTED ( DimProducts[ID_Product] ) )&lt;/P&gt;&lt;P&gt;VAR _SortedProducts =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;ALLSELECTED ( DimProducts[ID_Product] ),&lt;BR /&gt;"Sales", [Sales $]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _SortedProductsRanked =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;_SortedProducts,&lt;BR /&gt;"Rank", RANKX ( _SortedProducts, [Sales],, DESC, DENSE )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _CumulativeSalesTable =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;_SortedProductsRanked,&lt;BR /&gt;"CumulativeSales",&lt;BR /&gt;VAR CurrentRank = [Rank]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;FILTER ( _SortedProductsRanked, [Rank] &amp;lt;= CurrentRank ),&lt;BR /&gt;[Sales]&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _ProductsWithin80Percent =&lt;BR /&gt;FILTER (&lt;BR /&gt;_CumulativeSalesTable,&lt;BR /&gt;DIVIDE ( [CumulativeSales], _TotalSales, 0 ) &amp;lt;= 0.8&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;EVALUATE&amp;nbsp;_ProductsWithin80Percent&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Mar 2025 20:54:00 GMT</pubDate>
    <dc:creator>asparagus1_</dc:creator>
    <dc:date>2025-03-11T20:54:00Z</dc:date>
    <item>
      <title>Slow paginated report - The connection either timed out or was lost. Pareto Analysis</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Slow-paginated-report-The-connection-either-timed-out-or-was/m-p/4605762#M59801</link>
      <description>&lt;P&gt;I have a dataset in a Paginated Report that runs slowly because it includes a Pareto analysis of products on a table with around 200,000 rows. When I analyze its DAX query, it takes approximately 10 minutes to execute. Of course, this is not an ideal execution time, but it is what it is.&lt;/P&gt;&lt;P&gt;The problem is that in the Paginated Report, even when I run the report with filters on the product table, it is unable to generate at all. I receive the following error:&lt;BR /&gt;&lt;STRONG&gt;"The connection either timed out or was lost. Query execution failed for dataset 'XXX'."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is there anything I can do about this, or do I just have to keep optimizing the dataset's code?&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;P&gt;DEFINE&lt;BR /&gt;VAR _TotalSales =&lt;BR /&gt;CALCULATE ( [Sales $], ALLSELECTED ( DimProducts[ID_Product] ) )&lt;/P&gt;&lt;P&gt;VAR _SortedProducts =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;ALLSELECTED ( DimProducts[ID_Product] ),&lt;BR /&gt;"Sales", [Sales $]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _SortedProductsRanked =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;_SortedProducts,&lt;BR /&gt;"Rank", RANKX ( _SortedProducts, [Sales],, DESC, DENSE )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _CumulativeSalesTable =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;_SortedProductsRanked,&lt;BR /&gt;"CumulativeSales",&lt;BR /&gt;VAR CurrentRank = [Rank]&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;FILTER ( _SortedProductsRanked, [Rank] &amp;lt;= CurrentRank ),&lt;BR /&gt;[Sales]&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _ProductsWithin80Percent =&lt;BR /&gt;FILTER (&lt;BR /&gt;_CumulativeSalesTable,&lt;BR /&gt;DIVIDE ( [CumulativeSales], _TotalSales, 0 ) &amp;lt;= 0.8&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;EVALUATE&amp;nbsp;_ProductsWithin80Percent&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 20:54:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Slow-paginated-report-The-connection-either-timed-out-or-was/m-p/4605762#M59801</guid>
      <dc:creator>asparagus1_</dc:creator>
      <dc:date>2025-03-11T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Slow paginated report - The connection either timed out or was lost. Pareto Analysis</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Slow-paginated-report-The-connection-either-timed-out-or-was/m-p/4606276#M59804</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="730141" data-lia-user-login="asparagus1_" class="lia-mention lia-mention-user"&gt;asparagus1_&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You can refer the following link to optimize the query first:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://b-eye.com/blog/dax-query-optimization-power-bi/#:~:text=Best%20Practices%20for%20Optimizing%20DAX%20Queries%201%201.,...%205%205.%20Avoid%20Common%20Performance-Killing%20Patterns%20" target="_blank"&gt;DAX Query Optimization Techniques for Faster Calculations in Power BI: Advanced Guide&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DEFINE
    VAR _TotalSales =
        CALCULATE ( [Sales $], REMOVEFILTERS ( DimProducts[ID_Product] ) )
    VAR _ProductSales =
        SUMMARIZE (
            ALLSELECTED ( DimProducts ),
            DimProducts[ID_Product],
            "Sales", [Sales $]
        )
    VAR _SortedProductsRanked =
        ADDCOLUMNS (
            _ProductSales,
            "Rank", RANKX ( _ProductSales, [Sales],, DESC, DENSE )
        )
    VAR _CumulativeSalesTable =
        ADDCOLUMNS (
            _SortedProductsRanked,
            "CumulativeSales",
                VAR CurrentSales = [Sales]
                VAR CurrentRank = [Rank]
                RETURN
                    SUMX ( FILTER ( _SortedProductsRanked, [Rank] &amp;lt;= CurrentRank ), [Sales] )
        )

EVALUATE
FILTER (
    _CumulativeSalesTable,
    DIVIDE ( [CumulativeSales], _TotalSales, 0 ) &amp;lt;= 0.8
)&lt;/LI-CODE&gt;
&lt;P&gt;And i&lt;SPAN&gt;ncrease the Query Timeout:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/paginated-reports/report-design/setting-time-out-values-for-report-dataset-processing#set-a-query-time-out-for-a-dataset-in-a-report" target="_blank"&gt;Set time-out values for Power BI paginated report dataset processing - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 06:30:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Slow-paginated-report-The-connection-either-timed-out-or-was/m-p/4606276#M59804</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-12T06:30:34Z</dc:date>
    </item>
  </channel>
</rss>

