<?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 context weirdness in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599246#M75089</link>
    <description>&lt;P&gt;So strange... it gives me the same result as my initial formula. Randomly giving a different number depending on what I select in another visual:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is ok, filtered on 21st of june&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Here it gives me a different value (wrong) when filtered on the 20th of june:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My datamodel is incredibly simple: single table with sales transactions in rows, a column for price and a column for date. I made a calculated column that "rounds" the post date (which is datetime) to a regular date :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PostDate_DateFormat = &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;DAY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;That's the column I leverage in my Max Day Sales formula. Do you think it could come from there?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 03:23:34 GMT</pubDate>
    <dc:creator>paulpassot</dc:creator>
    <dc:date>2022-06-24T03:23:34Z</dc:date>
    <item>
      <title>Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599006#M75068</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps a newbie question, but I can't wrap my head around how a measure reacts to filters...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a measure that calculates sum of sales for the most recent day in the data :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Max Day Sales =&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceLine.Amount]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;MAXX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;)&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;When I create a table with &lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat] and this measure, I can see indeed the sales for the last date for every&amp;nbsp;Invoices_LQ[PostDate_DateFormat] line :&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, so good.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I create another visual showing&amp;nbsp;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat] and I select a value in there, sometimes it changes my Max Day Sales measure :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On top of that, it only seems to do so for certain&amp;nbsp;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat] only, and I haven't been able to identify some sort of pattern.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm guessing it has to do with some sort of context filtering I'm not understanding.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Still fairly new to PowerBI but this has given me a pretty bad headache!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone has a clue?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks a lot!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Jun 2022 00:05:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599006#M75068</guid>
      <dc:creator>paulpassot</dc:creator>
      <dc:date>2022-06-24T00:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599122#M75072</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405060" data-lia-user-login="paulpassot" class="lia-mention lia-mention-user"&gt;paulpassot&lt;/a&gt; , Try like &lt;/P&gt;
&lt;P&gt;Max Day Sales =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM( Invoices_LQ[InvoiceLine.Amount] ),&lt;BR /&gt;lastdate(Invoices_LQ[PostDate_DateFormat] )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for date&lt;/P&gt;
&lt;P&gt;MAxx(&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[PostDate_DateFormat]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 02:14:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599122#M75072</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-06-24T02:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599170#M75079</link>
      <description>&lt;P&gt;Unfortunately it doesn't work, it gives me the values for each date:&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;</description>
      <pubDate>Fri, 24 Jun 2022 02:41:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599170#M75079</guid>
      <dc:creator>paulpassot</dc:creator>
      <dc:date>2022-06-24T02:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599192#M75082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405060" data-lia-user-login="paulpassot" class="lia-mention lia-mention-user"&gt;paulpassot&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please try&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Max Day Sales =
VAR MaxDate =
    CALCULATE ( MAX ( Invoices_LQ[PostDate_DateFormat] ), REMOVEFILTERS () )
RETURN
    CALCULATE (
        SUM ( Invoices_LQ[InvoiceLine.Amount] ),
        Invoices_LQ[PostDate_DateFormat] = MaxDate,
        REMOVEFILTERS ()
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 02:49:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599192#M75082</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T02:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599220#M75083</link>
      <description>&lt;P&gt;Hi, thanks for the quick reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interestingly, it gives the same result across dates (which is good), but it doesn't seem to give the right number:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would expect 4,744$, not 5,358$.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand the logic of your code though, and I can't figure out how it comes up to 5,358$&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 03:09:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599220#M75083</guid>
      <dc:creator>paulpassot</dc:creator>
      <dc:date>2022-06-24T03:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599233#M75087</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405060" data-lia-user-login="paulpassot" class="lia-mention lia-mention-user"&gt;paulpassot&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I don't know how your data looks like but seems to me there are other filters. You may try **bleep** this way&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Max Day Sales =
VAR MaxDate =
    CALCULATE (
        MAX ( Invoices_LQ[PostDate_DateFormat] ),
        ALL ( Invoices_LQ[PostDate_DateFormat] )
    )
RETURN
    CALCULATE (
        SUM ( Invoices_LQ[InvoiceLine.Amount] ),
        Invoices_LQ[PostDate_DateFormat] = MaxDate,
        ALL ( Invoices_LQ[PostDate_DateFormat] )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 03:16:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599233#M75087</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T03:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599246#M75089</link>
      <description>&lt;P&gt;So strange... it gives me the same result as my initial formula. Randomly giving a different number depending on what I select in another visual:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is ok, filtered on 21st of june&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Here it gives me a different value (wrong) when filtered on the 20th of june:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My datamodel is incredibly simple: single table with sales transactions in rows, a column for price and a column for date. I made a calculated column that "rounds" the post date (which is datetime) to a regular date :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PostDate_DateFormat = &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;DAY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Invoices_LQ[InvoiceHeader.Column1.invoicePostDate]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;That's the column I leverage in my Max Day Sales formula. Do you think it could come from there?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 03:23:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599246#M75089</guid>
      <dc:creator>paulpassot</dc:creator>
      <dc:date>2022-06-24T03:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context weirdness</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599273#M75091</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405060" data-lia-user-login="paulpassot" class="lia-mention lia-mention-user"&gt;paulpassot&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Aparently this is Auto-Exist problem.&lt;/P&gt;&lt;P&gt;First step try to manually calculate the last day sales. If it does not match the result of my first solution then you need to have a date table that filters your data set. This will totally eleiminate the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 03:42:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-weirdness/m-p/2599273#M75091</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T03:42:47Z</dc:date>
    </item>
  </channel>
</rss>

