<?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 DirectQuery - COUNTX very slow in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513161#M134836</link>
    <description>&lt;P&gt;Hi expert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use function COUNTX in formula :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Number reference with a gap = COUNTX(FILTER(TABLE,[MEASURE]&amp;lt;&amp;gt;0),[REFERENCE])&lt;/LI-CODE&gt;&lt;P&gt;This formula is then used in a chart.&lt;BR /&gt;However, the graph takes a long time to respond.&lt;/P&gt;&lt;P&gt;Is there a DAX formula that would allow me to obtain my result more quickly or another way to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 21:09:13 GMT</pubDate>
    <dc:creator>Juju123</dc:creator>
    <dc:date>2023-11-02T21:09:13Z</dc:date>
    <item>
      <title>DirectQuery - COUNTX very slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513161#M134836</link>
      <description>&lt;P&gt;Hi expert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use function COUNTX in formula :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Number reference with a gap = COUNTX(FILTER(TABLE,[MEASURE]&amp;lt;&amp;gt;0),[REFERENCE])&lt;/LI-CODE&gt;&lt;P&gt;This formula is then used in a chart.&lt;BR /&gt;However, the graph takes a long time to respond.&lt;/P&gt;&lt;P&gt;Is there a DAX formula that would allow me to obtain my result more quickly or another way to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 21:09:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513161#M134836</guid>
      <dc:creator>Juju123</dc:creator>
      <dc:date>2023-11-02T21:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: DirectQuery - COUNTX very slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513667#M134866</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="605984" data-lia-user-login="Juju123" class="lia-mention lia-mention-user"&gt;Juju123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It depends !&lt;/P&gt;&lt;P&gt;How big is your model?&lt;BR /&gt;What is the [Measure] expression?&lt;/P&gt;&lt;P&gt;Can you share a sample of your data table (few rows and all columns) if that does not have any sensetive data?&lt;BR /&gt;If your table is big, why not to only keep [REFERENCE] with Values using the same filter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider &lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;it as the solution&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appreciate your Kudos!!&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.credly.com/users/vahid-doustimajd/badges" target="_blank"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank" rel="noopener noreferrer"&gt;LinkedIn&lt;/A&gt; | &lt;A href="https://twitter.com/VahidDMcom" target="_blank" rel="noopener noreferrer"&gt;Twitter&lt;/A&gt; | &lt;A href="https://www.vahiddm.com/" target="_blank" rel="noopener noreferrer"&gt;Blog&amp;nbsp;&lt;/A&gt;| &lt;A href="https://www.youtube.com/channel/UCF-uQfGF8de-EWnR9b2UQhQ" target="_blank" rel="noopener noreferrer"&gt;YouTube&lt;/A&gt;&lt;A href="https://www.youtube.com/channel/UCF-uQfGF8de-EWnR9b2UQhQ" target="_blank" rel="noopener noreferrer"&gt;&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 05:04:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513667#M134866</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2023-11-03T05:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: DirectQuery - COUNTX very slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513804#M134880</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your feedback.&lt;/P&gt;&lt;P&gt;Indeed I have a lot of data in my table and I have sensitive data.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I created all my measures in Power BI (they are all measure type columns and not calculated columns).&lt;/P&gt;&lt;P&gt;For this measurement: Number reference with a gap = COUNTX(FILTER(TABLE,[MEASURE]&amp;lt;&amp;gt;0),[REFERENCE])&lt;/P&gt;&lt;P&gt;1. I first created a “cumulative” measure&lt;/P&gt;&lt;P&gt;2. I created another measurement that calculates the distinct reference number.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DISTINCT REFERENCE = DISTINCTCOUNT(REFERENCE)&lt;/LI-CODE&gt;&lt;P&gt;3. I have just created this measure to calculate the measures whose accumulation is different from zero.&lt;/P&gt;&lt;P&gt;I changed DAX formula like this , but time it's no better&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;COUNTX(summarize(FILTER('TABLE_FACT','TABLE_FACT'[RUNNING_TOTAL]&amp;lt;&amp;gt;0),TABLE_FACT[REFERENCE]),[DISTINCT REFERENCE])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 06:50:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DirectQuery-COUNTX-very-slow/m-p/3513804#M134880</guid>
      <dc:creator>Juju123</dc:creator>
      <dc:date>2023-11-03T06:50:13Z</dc:date>
    </item>
  </channel>
</rss>

