<?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 overwriting behavior of CALCULATE in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995862#M100947</link>
    <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp; consider the query start at line 40, even though we set the filter context as empty, dax is returning product keys using ALL. PRODUCT[CATEGORY] = "Audio" is translated into&lt;/P&gt;&lt;P&gt;FILTER(ALL( PRODUCT[CATEGORY]),PRODUCT[CATEGORY] = "Audio").&lt;/P&gt;&lt;P&gt;&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;see the queries starting at line 25 and line 33, when we set the filter context to empty VALUES is returning empty list but ALL is still returning all values in that column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Jan 2023 08:45:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-01T08:45:56Z</dc:date>
    <item>
      <title>filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995842#M100944</link>
      <description>&lt;P&gt;I am not able to understand how nested CALCULATE statements overwrite the outer filter, in particular, one scenario where column overwrites the outer table filter:&amp;nbsp; Consider the following visual and measures. Model : Contoso from DAX book&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1) Sales Amount = &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Sales&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Sales&lt;/SPAN&gt;&lt;SPAN&gt;[Quantity]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;Sales&lt;/SPAN&gt;&lt;SPAN&gt;[Net Price]&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;2)&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Audio only Sales = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;[Sales Amount]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Product'&lt;/SPAN&gt;&lt;SPAN&gt;[Category]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Audio"&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;3) Nested CALC TABLE-FILTER FALSE =&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPA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;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt; ( 'Product'[Category] ), &lt;/SPAN&gt;&lt;SPAN&gt;FALSE&lt;/SPAN&gt;&lt;SPAN&gt; () )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am unable to understand why the measure&amp;nbsp;&lt;STRONG&gt;Nested CALC TABLE-FILTER FALSE&lt;/STRONG&gt; is returning the blank while the measure&amp;nbsp;&lt;STRONG&gt;Nested CALC COLUMN-FILTER FALSE &lt;/STRONG&gt;is returning Audio sales.&amp;nbsp; I expect &lt;STRONG&gt;Nested CALC TABLE-FILTER FALSE&amp;nbsp;&lt;/STRONG&gt;should return Audio sales. Can you please help me to understand this behavior?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 01 Jan 2023 06:42:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995842#M100944</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-01T06:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995847#M100945</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;because in (4) both the inner and outer CALCULATE filters are filtering the same column. Therefore, the inner CALCULATE replaces the outer CALCULATE filter and the result is "Audio".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While number 3 filters all the products (another column with different granularity). This filter which is a empty table, is not replaced by the inner filter rather it is intersected with it and the interaction between the two filters is an empty table that returns blank.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 07:30:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995847#M100945</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-01T07:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995848#M100946</link>
      <description>&lt;P&gt;First of all, presume that 'Product' table consists of other columns on top of&amp;nbsp;&lt;SPAN&gt;'Product'&lt;/SPAN&gt;&lt;SPAN&gt;[Category], say&amp;nbsp;'Product'[ID].&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Nested CALC TABLE-FILTER FALSE =
CALCULATE (
    CALCULATE ( [Sales Amount], 'Product'[Category] = "Audio" ),
    FILTER ( ALL ( 'Product' ), FALSE () )
)&lt;/LI-CODE&gt;
&lt;P&gt;Inner filter 'Product'[Category] = "Audio" overrides part of outer filter, ie&amp;nbsp;'Product'[Category] = BLANK(), but&amp;nbsp;'Product'[ID] = BLANK() DOES still exist, as well as any other filters on other columns of 'Product'.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 07:47:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995848#M100946</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2023-01-01T07:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995862#M100947</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp; consider the query start at line 40, even though we set the filter context as empty, dax is returning product keys using ALL. PRODUCT[CATEGORY] = "Audio" is translated into&lt;/P&gt;&lt;P&gt;FILTER(ALL( PRODUCT[CATEGORY]),PRODUCT[CATEGORY] = "Audio").&lt;/P&gt;&lt;P&gt;&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;see the queries starting at line 25 and line 33, when we set the filter context to empty VALUES is returning empty list but ALL is still returning all values in that column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 08:45:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995862#M100947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-01T08:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995869#M100948</link>
      <description>&lt;P&gt;What you want to say? Or you mean to teach me something new?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 09:38:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995869#M100948</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2023-01-01T09:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995870#M100949</link>
      <description>&lt;P&gt;Not at all. I am sorry if you feel like that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;your point&amp;nbsp;&lt;EM&gt;but&amp;nbsp;'Product'[ID] = BLANK() DOES still exist, as well as any other filters on other columns of 'Product'.&amp;nbsp;&lt;/EM&gt;You said Product[ID] = BLANK() still exist, I was trying to show you&amp;nbsp;Product[ID] is not blank even thogh we set the filter on Product table is empty as you can see in the query at line 40.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jan 2023 09:48:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995870#M100949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-01T09:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995875#M100950</link>
      <description>&lt;P&gt;(at line 40) You expect ALL() returns all the visible rows in the current filter context; but it's NOT the case for ALL(). It's now used as a top-level table expression, r&lt;SPAN&gt;eturning all the rows in a table, or all the values in a column, ignoring any filters that might have been applied.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Instead, you should use,&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATETABLE (
    VALUES ( 'Product'[ProductKey] ),
    FILTER ( ALL ( 'Product' ), FALSE () )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 01 Jan 2023 10:16:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/2995875#M100950</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2023-01-01T10:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: filter overwriting behavior of CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/3011384#M102100</link>
      <description>&lt;P&gt;Thanks for the help. CALCULATE is behaving as per your explanation.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 14:30:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-overwriting-behavior-of-CALCULATE/m-p/3011384#M102100</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-10T14:30:44Z</dc:date>
    </item>
  </channel>
</rss>

