<?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: FILTER Performance in Composite Model with Aggs Very Slow in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445981#M27107</link>
    <description>&lt;P&gt;how about using TREATAS to create a virtual relationship?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;CALCULATE (
            SUM ( 'Sales Ticket'[Ticket_Count] ),
            TREATAS(CALCULATETABLE(VALUES('Sales Agg Date Store'[STORE_KEY]),
                'Sales Agg Date Store'[Sales Above Threshold Flag]
            ),'Sales Ticket'[STORE_KEY])

        )&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 21 Oct 2020 04:54:29 GMT</pubDate>
    <dc:creator>wdx223_Daniel</dc:creator>
    <dc:date>2020-10-21T04:54:29Z</dc:date>
    <item>
      <title>FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445160#M27072</link>
      <description>&lt;P&gt;Hello... I have a composite model, with 2 levels of aggregate tables.&amp;nbsp; I have a &lt;U&gt;measure that looks simple enough, but it is taking about 10 seconds to return results&lt;/U&gt;.&amp;nbsp; Here's the relevant segment of the model I'm working with. It's a pretty standard "Salesy" type of model...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Fact Tables:&lt;/P&gt;&lt;P&gt;1) &lt;STRONG&gt;Sales Agg Date Store&lt;/STRONG&gt; - Import Mode - 4 million rows - Aggregate table&lt;/P&gt;&lt;P&gt;2) &lt;STRONG&gt;Sales Agg Extended&lt;/STRONG&gt; - Import Mode - 20 million rows - Aggregate table&lt;/P&gt;&lt;P&gt;3) &lt;STRONG&gt;Sales Ticket&lt;/STRONG&gt; - Direct Query Mode - 600 million rows - transaction level detail&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This DAX measure is taking about 10 seconds to return when I add the FILTER clause:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        CALCULATE (
            SUM ( 'Sales Ticket'[Ticket_Count] ),
            FILTER (
                'Sales Agg Date Store',
                'Sales Agg Date Store'[Sales Above Threshold Flag]
            )
        )&lt;/LI-CODE&gt;&lt;P&gt;The basic idea is I want to get a sum of Ticket_Count for days and stores where the sales threshold was met. (we don't count days with little activity). That &lt;EM&gt;sales above&amp;nbsp;threshold flag&lt;/EM&gt; is only in the highest level aggregate table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see in DAX Studio that the measure is mapping the aggregation successfully from the [Sales Ticket] table up to the [Sales Agg Date Store] table. So it should be pretty fast. But it isnt.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried replacing the FILTER with CALCULATETABLE. No luck. Can anybody think of anything I am missing to help with the performance of this measure?&amp;nbsp; Maybe my model design needs to be blown up.&amp;nbsp; That could be too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for looking!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 15:12:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445160#M27072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-20T15:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445251#M27075</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see no&amp;nbsp;relationship between&amp;nbsp; 'Sales Agg Date Store' and 'Sales Ticket'. Am I seeing it incorrectly? If there is no relationship, what is the point of the filter?&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;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 16:34:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445251#M27075</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-10-20T16:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445286#M27076</link>
      <description>&lt;P&gt;Hi&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;.. thanks for your response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to pull the [Sales Above Threshold Flag] from the [Sales Agg Date Store] table and apply it to the aggregate hierarchy (i.e. any one of the three fact tables) based on their mutual relationships with the [Calendar] and [Store] tables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The filter provides the unique combinations of [STORE_KEY] and [Ticket_Created_date] that I need to include for sales on days where the store's total met the minimum daily threshold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know, relationships between fact tables is not a best practice, but maybe it would help here.&amp;nbsp; I tried it a while ago, but the cardinality of the relationships was so high that it became a burden to refresh the model frequently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 16:48:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445286#M27076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-20T16:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445624#M27090</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try perhaps using only the relevant column instead of the whole table as base for the filter:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
            SUM ( 'Sales Ticket'[Ticket_Count] ),
            FILTER (
                ALL('Sales Agg Date Store'[Sales Above Threshold Flag]),
                'Sales Agg Date Store'[Sales Above Threshold Flag]
            )
        )&lt;/LI-CODE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
            SUM ( 'Sales Ticket'[Ticket_Count] ),
            FILTER (
                DISTINCT('Sales Agg Date Store'[Sales Above Threshold Flag]),
                'Sales Agg Date Store'[Sales Above Threshold Flag]
            )
        )&lt;/LI-CODE&gt;
&lt;P&gt;which would be actually be the equivalent of what you had (since you were not using ALL on the whole table)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 21:58:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445624#M27090</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-10-20T21:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445975#M27106</link>
      <description>&lt;P&gt;Thanks again for taking a look. I really appreciate it!&amp;nbsp; The proposed DAX didn't work. I think I just am better off propagating the filter column throughout all levels of my aggregation. So I added it in the source for all 3 fact tables, now I can just write it real easy like this...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"Ticket_Count_Above_Threshold", CALCULATE ( [Ticket Count], 'Sales Ticket'[Sales Above Threshold Flag] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;... and the aggregation magic in Power BI rolls it up as much as possible.&amp;nbsp; Amazing stuff.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 04:29:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445975#M27106</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T04:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445981#M27107</link>
      <description>&lt;P&gt;how about using TREATAS to create a virtual relationship?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;CALCULATE (
            SUM ( 'Sales Ticket'[Ticket_Count] ),
            TREATAS(CALCULATETABLE(VALUES('Sales Agg Date Store'[STORE_KEY]),
                'Sales Agg Date Store'[Sales Above Threshold Flag]
            ),'Sales Ticket'[STORE_KEY])

        )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 04:54:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1445981#M27107</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2020-10-21T04:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: FILTER Performance in Composite Model with Aggs Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1446771#M27125</link>
      <description>&lt;P&gt;There's a golden rule in DAX programming: NEVER USE A TABLE WHEN YOU CAN USE A COLUMN. You are violating this rule. You should never filter by full tables since this will ALWAYS be slow and, in fact, dangerous. Secondly, you should not use the aggregated tables in your formulas. Just don't create dependency on something that might not be there at all. Aggregate tables should be &lt;STRONG&gt;invisible&lt;/STRONG&gt; to you. It's only a machinery to speed up queries/measures and it's intended solely for the SSAS engine. Please therefore change the measure and make sure that when you think aggregations are used, they really are.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 10:22:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/FILTER-Performance-in-Composite-Model-with-Aggs-Very-Slow/m-p/1446771#M27125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T10:22:45Z</dc:date>
    </item>
  </channel>
</rss>

