<?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: Calculate overrides filter context only on date table but not from sales table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3547929#M136446</link>
    <description>&lt;P&gt;Owen, thank you this. Very crisp and clear explanation. Plus a good lesson here to group by columns of DIM tables only.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Nov 2023 01:49:51 GMT</pubDate>
    <dc:creator>pankajsk83</dc:creator>
    <dc:date>2023-11-23T01:49:51Z</dc:date>
    <item>
      <title>Calculate overrides filter context only on date table but not from sales table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3545756#M136329</link>
      <description>&lt;P&gt;I am trying to understand how calculate overrides the filter context. Below, I have a very simple formula. The matrix visual at the top has the date from sales table. The one below has the data from the dates(calendar) table. Why does calculate override filter context only below and not in the one above? I was expecting the above table to also have the same values as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 00:35:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3545756#M136329</guid>
      <dc:creator>pankajsk83</dc:creator>
      <dc:date>2023-11-22T00:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate overrides filter context only on date table but not from sales table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3545985#M136340</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="650008" data-lia-user-login="pankajsk83" class="lia-mention lia-mention-user"&gt;pankajsk83&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic explanation is that filters apply to specific columns. Filters on 'Date'[Date] are distinct from filters on Sales[Order Date] even though there is a relationship between them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This means that, when a filter argument for a particular column is specified in CALCULATE:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Any existing filter on that same column is replaced by the new filter.&lt;/LI&gt;
&lt;LI&gt;Any existing filters on other columns remain in place, and are effectively "intersected" with the new filter.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Using your example, assuming no other filters exist:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;For the 2nd visual,&lt;STRONG&gt; 'Date'[Date]&lt;/STRONG&gt; is on the rows of the visual.&lt;BR /&gt;Let's consider the row with 'Date'[Date] = 2017-01-01.&lt;BR /&gt;
&lt;UL&gt;
&lt;LI&gt;Existing filter context in this row is a single filter &lt;STRONG&gt;'Date'[Date] = 2017-01-01&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;New filter from CALCULATE is &lt;STRONG&gt;'Date'[Date] IN { 2017-05-19, 2017-05-20 }&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Since the New filter is on the same column as the Existing filter, the Existing filter is replaced.&lt;/LI&gt;
&lt;LI&gt;The resulting filter context is therefore just &lt;STRONG&gt;'Date'[Date] IN { 2017-05-19, 2017-05-20 }&lt;/STRONG&gt;, and it will be the same on every row of the visual.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;For the 1st visual, &lt;STRONG&gt;Sales[Order Date]&lt;/STRONG&gt; is on the rows of the visual.&lt;BR /&gt;Let's consider the row with Sales[Order Date] = 2017-05-19.
&lt;UL&gt;
&lt;LI&gt;Existing filter context in this row is a single filter &lt;STRONG&gt;Sales[Order Date] = 2017-05-19&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;New filter from CALCULATE is &lt;STRONG&gt;'Date'[Date] IN { 2017-05-19, 2017-05-20 }&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Since the New filter is on a different column from the Existing filter, both filters will be in effect when evaluating the first argument of CALCULATE.&lt;/LI&gt;
&lt;LI&gt;The resulting filter context is therefore&amp;nbsp;&lt;STRONG&gt;Sales[Order Date] = 2017-05-19 AND&amp;nbsp;'Date'[Date] IN { 2017-05-19, 2017-05-20 }&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;Because of the relationship between Sales and 'Date' tables, the value of [Sales Amount] will be blank unless Sales[Order Date] from the current row of the visual is within the range 2017-05-19 to 2017-05-20, i.e. the two rows that are visible.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;To avoid this kind of confusion, it is generally recommended to filter or group by columns of dimension tables only, not fact tables. In this particular case, I would suggest that &lt;STRONG&gt;Sales[Order Date]&lt;/STRONG&gt; should be hidden and not included in any visuals, and instead just use columns of the 'Date' table (there may be exceptions to this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 04:01:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3545985#M136340</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-11-22T04:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate overrides filter context only on date table but not from sales table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3547929#M136446</link>
      <description>&lt;P&gt;Owen, thank you this. Very crisp and clear explanation. Plus a good lesson here to group by columns of DIM tables only.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2023 01:49:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-overrides-filter-context-only-on-date-table-but-not/m-p/3547929#M136446</guid>
      <dc:creator>pankajsk83</dc:creator>
      <dc:date>2023-11-23T01:49:51Z</dc:date>
    </item>
  </channel>
</rss>

