<?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: Performance Issue with COUNTROWS Summarize in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061408#M105800</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159551" data-lia-user-login="gardas_swathi" class="lia-mention lia-mention-user"&gt;gardas_swathi&lt;/a&gt;&amp;nbsp;Can you share the screenshot of the diagram view, use VALUES ( &lt;SPAN&gt;Product'[ID] )&amp;nbsp;&lt;/SPAN&gt;from&lt;SPAN&gt;&amp;nbsp;product table as I forgot there are multiple facts. So VALUES ( Demand[ProductID] ) won't transfer the filter from context transition to other tables that aren't related to Demand Table.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Feb 2023 07:35:29 GMT</pubDate>
    <dc:creator>AntrikshSharma</dc:creator>
    <dc:date>2023-02-04T07:35:29Z</dc:date>
    <item>
      <title>Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059400#M105643</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need somehelp in rewriting my DAX Measure. Below Measure is taking atleast 2-3 mins to get the data from the tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Demand],[MonthlySupply] &amp;amp;[NetAvailSupplyDemand] are existing measures in the Cube with some inbuilt logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get the count of distinct product ID's based on conditions used in the measure.&amp;nbsp; I have many other dimensions in the cube and below measure should be able to return data based on the selection ( like Area/ Time). How can i better write the below measure and give the same expected output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For context - product table has 1.6M unique products, Demand table has 215M records and Supply table has 147M records&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Product Coverage:=&lt;BR /&gt;VAR RowCount =&lt;BR /&gt;COUNTROWS (&lt;BR /&gt;FILTER (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;'Demand Table',&lt;BR /&gt;'Product'[ID]&lt;BR /&gt;),&lt;BR /&gt;(IF (&lt;BR /&gt;(&lt;BR /&gt;( ISBLANK ( [Demand] ) = TRUE || [Demand] &amp;lt;= 0 )&lt;BR /&gt;&amp;amp;&amp;amp; ( ISBLANK ( [MonthlySupply] ) = TRUE || [MonthlySupply] &amp;lt;= 0 )&lt;BR /&gt;&amp;amp;&amp;amp; ( ISBLANK ([NetAvailSupplyDemand] ) = TRUE | [NetAvailSupplyDemand] &amp;lt;= 0 )&lt;BR /&gt;) || ( (ISBLANK ( [Demand] ) = TRUE || [Demand] &amp;lt;= 0 ) &amp;amp;&amp;amp; [MonthlySupply] &amp;gt; 0),&lt;BR /&gt;-1,&lt;BR /&gt;IF (( ISBLANK ( [Demand] ) = FALSE || [Demand] &amp;gt; 0) &amp;amp;&amp;amp; ( ISBLANK ( [MonthlySupply] ) = TRUE|| [MonthlySupply] = 0),-1,[NetAvailSupplyDemand])&lt;BR /&gt;) &amp;gt;= 0&lt;BR /&gt;)))&lt;BR /&gt;RETURN IF ( ISBLANK ( RowCount ) = TRUE &amp;amp;&amp;amp; [NetAvailSupplyDemand] &amp;lt;= 0,0,RowCount )&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 02:55:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059400#M105643</guid>
      <dc:creator>gardas_swathi</dc:creator>
      <dc:date>2023-02-03T02:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059552#M105648</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159551" data-lia-user-login="gardas_swathi" class="lia-mention lia-mention-user"&gt;gardas_swathi&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Product Coverage :=
VAR RowCount =
    COUNTROWS (
        FILTER (
            SUMMARIZE ( 'Demand Table', 'Product'[ID] ),
            VAR Demand = [Demand]
            VAR MonthlySupply = [MonthlySupply]
            VAR NetAvailSupplyDemand = [NetAvailSupplyDemand]
            RETURN
                IF (
                    (
                        (
                            ISBLANK ( Demand )
                                || Demand &amp;lt;= 0
                        )
                            &amp;amp;&amp;amp; (
                                ISBLANK ( MonthlySupply )
                                    || MonthlySupply &amp;lt;= 0
                            )
                            &amp;amp;&amp;amp; (
                                ISBLANK ( NetAvailSupplyDemand )
                                    || NetAvailSupplyDemand &amp;lt;= 0
                            )
                    )
                        || (
                            (
                                ISBLANK ( Demand )
                                    || Demand &amp;lt;= 0
                            )
                                &amp;amp;&amp;amp; MonthlySupply &amp;gt; 0
                        ),
                    -1,
                    IF (
                        (
                            NOT ISBLANK ( Demand )
                                || Demand &amp;gt; 0
                        )
                            &amp;amp;&amp;amp; (
                                ISBLANK ( MonthlySupply )
                                    || MonthlySupply = 0
                            ),
                        -1,
                        NetAvailSupplyDemand
                    )
                ) &amp;gt;= 0
        )
    )
RETURN
    IF ( ISBLANK ( RowCount ) &amp;amp;&amp;amp; [NetAvailSupplyDemand] &amp;lt;= 0, 0, RowCount )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 05:26:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059552#M105648</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-03T05:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059713#M105656</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159551" data-lia-user-login="gardas_swathi" class="lia-mention lia-mention-user"&gt;gardas_swathi&lt;/a&gt;&amp;nbsp;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Product Coverage :=
VAR DemandProductIDColumn =
    VALUES ( 'Demand Table'[Product ID] )
VAR NewColumns =
    ADDCOLUMNS (
        DemandProductIDColumn,
        "@Demand", [Demand],
        "@MonthlySupply", [MonthlySupply],
        "@NetAvailSupplyDemand", [NetAvailSupplyDemand]
    )
VAR FilterRows =
    FILTER (
        NewColumns,
        VAR Demand_True_LessThanZero =
            ISBLANK ( [@Demand] ) = TRUE
                || [@Demand] &amp;lt;= 0
        VAR MonthlySupply_True_LessThanZero =
            ISBLANK ( [@MonthlySupply] ) = TRUE
                || [@MonthlySupply] &amp;lt;= 0
        VAR NetAvailSupplyDemand_True_LessThanZero =
            ISBLANK ( [@NetAvailSupplyDemand] ) = TRUE
                || [@NetAvailSupplyDemand] &amp;lt;= 0
        VAR Demand_FalseNotZero =
            ISBLANK ( [Demand] ) = FALSE
                || [Demand] &amp;gt; 0
        VAR MonthlySupply_True_Zero =
            ISBLANK ( [@MonthlySupply] ) = TRUE
                || [@MonthlySupply] = 0
        VAR Result =
            IF (
                OR (
                    Demand_True_LessThanZero &amp;amp;&amp;amp; MonthlySupply_True_LessThanZero
                        &amp;amp;&amp;amp; NetAvailSupplyDemand_True_LessThanZero,
                    Demand_True_LessThanZero
                        &amp;amp;&amp;amp; [@MonthlySupply] &amp;gt; 0
                ),
                -1,
                IF (
                    Demand_FalseNotZero &amp;amp;&amp;amp; MonthlySupply_True_Zero,
                    -1,
                    [@NetAvailSupplyDemand]
                )
            )
        RETURN
            Result &amp;gt; 0
    )
VAR RowCount =
    COUNTROWS ( FilterRows )
VAR Result =
    IF ( ISBLANK ( RowCount ) = TRUE &amp;amp;&amp;amp; [NetAvailSupplyDemand] &amp;lt;= 0, 0, RowCount )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:53:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3059713#M105656</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2023-02-03T06:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061053#M105759</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response. This solution has not reduced the performance significantly. Its taking 30 seconds less than it used to before. However i am seeing this error in the last line. Is it because we are using NetAvailSupplyDemand Variable outside the context of creation?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 20:33:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061053#M105759</guid>
      <dc:creator>gardas_swathi</dc:creator>
      <dc:date>2023-02-03T20:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061060#M105760</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to execute VAR New Columns to see the data. I observed that MonthlySupply and NetAvailSupplyDemand are not slicable by productID. Screenshot for reference. I have changed the measure names in my original post to make it simple. Below screenshot the measure names . All these tables are related to Product Table. Monthly Supply is all same for all the product ID's . Net Avail Formula is MonthlySupply-Demand, so Net Avail values seem to change a bit . But overall values in below table are incorrect. I need to get Demand, Monthly Supply and Net Avail by Product ID and then do all the checks&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>Fri, 03 Feb 2023 20:42:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061060#M105760</guid>
      <dc:creator>gardas_swathi</dc:creator>
      <dc:date>2023-02-03T20:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue with COUNTROWS Summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061408#M105800</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159551" data-lia-user-login="gardas_swathi" class="lia-mention lia-mention-user"&gt;gardas_swathi&lt;/a&gt;&amp;nbsp;Can you share the screenshot of the diagram view, use VALUES ( &lt;SPAN&gt;Product'[ID] )&amp;nbsp;&lt;/SPAN&gt;from&lt;SPAN&gt;&amp;nbsp;product table as I forgot there are multiple facts. So VALUES ( Demand[ProductID] ) won't transfer the filter from context transition to other tables that aren't related to Demand Table.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 07:35:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Performance-Issue-with-COUNTROWS-Summarize/m-p/3061408#M105800</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2023-02-04T07:35:29Z</dc:date>
    </item>
  </channel>
</rss>

