<?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: Dax performance of calculatetable vs filter with multiple conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119816#M163566</link>
    <description>&lt;P&gt;Thank you, but it doesn't explain the performance difference, because I am comparing Filter Vs Calculatetable, which both result in a table.&lt;/P&gt;&lt;P&gt;I should also add, when I remove the additional condition of&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;,’Table’[Attribute] &amp;lt;&amp;gt; "Count" in my calculatetable function, it performs ok.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 04:09:00 GMT</pubDate>
    <dc:creator>TrevLc</dc:creator>
    <dc:date>2024-08-27T04:09:00Z</dc:date>
    <item>
      <title>Dax performance of calculatetable vs filter with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119613#M163558</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I thought calculatetable would provide better performace over the use of filter to create a filtered table (in a variable) when using multiple filter conditions.&lt;/P&gt;&lt;P&gt;However, I am seeing the opposite (and it is very significant)&lt;/P&gt;&lt;P&gt;Can someone please help me understand why calculatetable is significantly slower?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my measure:&lt;/P&gt;&lt;P&gt;I have commented out the alternative (that is faster) for "var b"&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Attribute List =&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;var a = VALUES(‘Table’[ID]) //This list is obtained when a user clicks on another visual aggregated by another column&lt;/P&gt;&lt;P&gt;var b =&amp;nbsp;&amp;nbsp;CALCULATETABLE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SUMMARIZE(‘Table’, ‘Table’[ID], ‘Table’[Attribute]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ‘Table’[ID] in a&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,’Table’[Attribute] &amp;lt;&amp;gt; "Count"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;//&amp;nbsp;var b = FILTER(SUMMARIZECOLUMNS( ‘Table’[ID], ‘Table’[Attribute],&lt;/P&gt;&lt;P&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER(‘Table’, ‘Table’[ID] in a &amp;amp;&amp;amp; ‘Table’[Attribute] &amp;lt;&amp;gt; "Count")&lt;/P&gt;&lt;P&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ), TRUE()&lt;/P&gt;&lt;P&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;var c = CONCATENATEX(b,’Table’[Attribute]," , ")&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;IF(ISINSCOPE(‘Table’[ID]),c)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To keep it simple, here is a small sample of my data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;(my actual data is not that big (about 500k rows), but has more columns than below - I have only given relavant columns)&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Attribute&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Excel&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Word&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Access&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;PowerPoint&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Access&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;PowerPoint&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;Word&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;Excel&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;Word&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;PowerPoint&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 27 Aug 2024 01:46:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119613#M163558</guid>
      <dc:creator>TrevLc</dc:creator>
      <dc:date>2024-08-27T01:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dax performance of calculatetable vs filter with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119658#M163562</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="356186" data-lia-user-login="TrevLc" class="lia-mention lia-mention-user"&gt;TrevLc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is a good article about calculatetable vs calculate.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/CALCULATE-amp-CALCULATETABLE-What-s-The-Real-Difference/ba-p/745518" target="_blank"&gt;CALCULATE &amp;amp; CALCULATETABLE - What's The Real Diffe... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it might have performance impact since CALCULATE results in scalar and CALCULATETABLE results in table (or virtual table). perhaps that is what you are looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 02:12:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119658#M163562</guid>
      <dc:creator>Irwan</dc:creator>
      <dc:date>2024-08-27T02:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dax performance of calculatetable vs filter with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119816#M163566</link>
      <description>&lt;P&gt;Thank you, but it doesn't explain the performance difference, because I am comparing Filter Vs Calculatetable, which both result in a table.&lt;/P&gt;&lt;P&gt;I should also add, when I remove the additional condition of&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;,’Table’[Attribute] &amp;lt;&amp;gt; "Count" in my calculatetable function, it performs ok.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 04:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4119816#M163566</guid>
      <dc:creator>TrevLc</dc:creator>
      <dc:date>2024-08-27T04:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dax performance of calculatetable vs filter with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4122095#M163670</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="356186" data-lia-user-login="TrevLc" class="lia-mention lia-mention-user"&gt;TrevLc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, you're right, in general, CALCULATETABLE() runs faster than FILTER(), but there are exceptions:&lt;/P&gt;
&lt;P&gt;When you need more than one filter depending on external contexts and you have to evaluate a distinct count(The SUMMARIZE() function) measure.&lt;/P&gt;
&lt;P&gt;Here is a link for your reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/filter-vs-calculatetable-optimization-using-cardinality-estimation/#:~:text=The%20measure%20OrdersInPlaceSingleFilter,is%20very%20slow%3A" target="_self"&gt;Filter vs Calculatetable&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 06:54:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-performance-of-calculatetable-vs-filter-with-multiple/m-p/4122095#M163670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-28T06:54:16Z</dc:date>
    </item>
  </channel>
</rss>

