<?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: Why is my filter direction getting ignored? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162833#M113641</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;.&amp;nbsp;Your suggestion unfortunately does not work. If we use the minimal example &lt;A href="https://we.tl/t-6VPS2ePN6T" target="_self"&gt;here&lt;/A&gt; with this schema:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following does not affect the result:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    VAR FilteredOrders =   
        FILTER ( Orders, Orders[ID] = 2 )
    RETURN
        CALCULATE ( MAX ( Customers[Credit Limit] ), FilteredOrders, REMOVEFILTERS(Customers) )&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 30 Mar 2023 08:22:11 GMT</pubDate>
    <dc:creator>Kurren</dc:creator>
    <dc:date>2023-03-30T08:22:11Z</dc:date>
    <item>
      <title>Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3161301#M113547</link>
      <description>&lt;P&gt;You can see a simple example of this problem &lt;A href="https://we.tl/t-6VPS2ePN6T" target="_blank" rel="noopener"&gt;here&lt;/A&gt;, a dashboard with only 2 tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an invoices and a dates table, many invoices to one date. The filter direction is from dates to invoices, like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I evaluate the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;CALCULATE ( MAX ( Dates[Date] ), Invoices[ID] = "0,92270" )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get back the maximum date in the date table: 31/12/2022.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I evaulate this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;VAR FilteredInvoices = FILTER ( Invoices, Invoices[ID] = "0,92270" )
RETURN
  CALCULATE ( MAX ( Dates[Date] ), FilteredInvoices )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I get back the invoice date for the invoice I filtered; the Dates table is being filtered. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Why is the date table being filtered in the second query but not in the first, I thought the two statements were equivalent? Also how can I remove the filter on the dates table in the second statement?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:48:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3161301#M113547</guid>
      <dc:creator>Kurren</dc:creator>
      <dc:date>2023-03-29T15:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3161361#M113551</link>
      <description>&lt;P&gt;When you filter a table, as opposed to a column, the entire expanded table gets added into the filter context, and that includes tables at the one-side of a relationship from the filtered table, so the entire date table is being added to the filter context in addition to the invoices table.&lt;/P&gt;
&lt;P&gt;You could add REMOVEFILTERS('Date') to the CALCULATE in the second snippet if you needed to.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3161361#M113551</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-03-29T15:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162833#M113641</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;.&amp;nbsp;Your suggestion unfortunately does not work. If we use the minimal example &lt;A href="https://we.tl/t-6VPS2ePN6T" target="_self"&gt;here&lt;/A&gt; with this schema:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following does not affect the result:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    VAR FilteredOrders =   
        FILTER ( Orders, Orders[ID] = 2 )
    RETURN
        CALCULATE ( MAX ( Customers[Credit Limit] ), FilteredOrders, REMOVEFILTERS(Customers) )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 08:22:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162833#M113641</guid>
      <dc:creator>Kurren</dc:creator>
      <dc:date>2023-03-30T08:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162865#M113645</link>
      <description>&lt;P&gt;Table variables are immutable, meaning the filter has to be applied at the variable stage try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; VAR FilteredOrders =   
        FILTER ( Orders, Orders[ID] = 2 ,REMOVEFILTERS( Customers ))
    RETURN
        CALCULATE ( MAX ( Customers[Credit Limit] ), FilteredOrders )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 08:35:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162865#M113645</guid>
      <dc:creator>JohnShepherdAPD</dc:creator>
      <dc:date>2023-03-30T08:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162893#M113647</link>
      <description>&lt;P&gt;You're right, because both the filter table and REMOVEFILTERS are at the same level they are not interacting. You could use the following convoluted code&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR FilteredOrders = FILTER( 'Orders', 'Orders'[ID] = 2 )
RETURN
	CALCULATE(
		MAXX(
			ALL( 'Customers'[Credit Limit] ),
			'Customers'[Credit Limit]
		),
		FilteredOrders
	)&lt;/LI-CODE&gt;
&lt;P&gt;but it is obviously better to use the code from the first snippet in your original post.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 08:44:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3162893#M113647</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-03-30T08:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my filter direction getting ignored?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3163001#M113651</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="393250" data-lia-user-login="Kurren" class="lia-mention lia-mention-user"&gt;Kurren&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You need to read about expanded tables &lt;A href="https://www.sqlbi.com/articles/expanded-tables-in-dax/" target="_blank"&gt;Expanded tables in DAX - SQLBI&lt;/A&gt;. And yes, if you place the fact table as CALCULATE filter argument it will filter the Dimension&amp;nbsp;table. This is actually a common patter often use to calculate values based on dimension&amp;nbsp;tables. The reason is that the columns of the Customer table are part of the expanded Orders table. I have put the last example in a separate screenshot to clarify the idea.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 09:35:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-filter-direction-getting-ignored/m-p/3163001#M113651</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-30T09:35:12Z</dc:date>
    </item>
  </channel>
</rss>

