<?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 Measure context issue in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2318151#M57832</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am coming to you guys because I have an issue regarding a measure that I was not able to solve yet:&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;What I would like is to filter &lt;EM&gt;&lt;STRONG&gt;Date TO Compare&lt;/STRONG&gt;&lt;/EM&gt; (FIELD of &lt;EM&gt;&lt;STRONG&gt;TABLE1&lt;/STRONG&gt;&lt;/EM&gt;) with the &lt;EM&gt;&lt;STRONG&gt;Non Context Date &lt;/STRONG&gt;&lt;/EM&gt;(Measure with &lt;EM&gt;&lt;STRONG&gt;ALLSELECTED(TABLE1)&lt;/STRONG&gt;&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;I am doing the following command:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max TEST 3 = CALCULATE(DISTINCTCOUNT(TABLE1.FIELD1), FILTER(TABLE1, TABLE1.DateToCompare &amp;lt;= TABLE1.NonContextDate))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it seems the &lt;EM&gt;&lt;STRONG&gt;Context Date&lt;/STRONG&gt;&lt;/EM&gt; is used instead of &lt;EM&gt;&lt;STRONG&gt;Non Context Date&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Here the result:&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;Thank you, in advance, for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 16:56:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-02-03T16:56:56Z</dc:date>
    <item>
      <title>Measure context issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2318151#M57832</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am coming to you guys because I have an issue regarding a measure that I was not able to solve yet:&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;What I would like is to filter &lt;EM&gt;&lt;STRONG&gt;Date TO Compare&lt;/STRONG&gt;&lt;/EM&gt; (FIELD of &lt;EM&gt;&lt;STRONG&gt;TABLE1&lt;/STRONG&gt;&lt;/EM&gt;) with the &lt;EM&gt;&lt;STRONG&gt;Non Context Date &lt;/STRONG&gt;&lt;/EM&gt;(Measure with &lt;EM&gt;&lt;STRONG&gt;ALLSELECTED(TABLE1)&lt;/STRONG&gt;&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;I am doing the following command:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max TEST 3 = CALCULATE(DISTINCTCOUNT(TABLE1.FIELD1), FILTER(TABLE1, TABLE1.DateToCompare &amp;lt;= TABLE1.NonContextDate))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it seems the &lt;EM&gt;&lt;STRONG&gt;Context Date&lt;/STRONG&gt;&lt;/EM&gt; is used instead of &lt;EM&gt;&lt;STRONG&gt;Non Context Date&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Here the result:&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;Thank you, in advance, for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 16:56:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2318151#M57832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-03T16:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Measure context issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2319922#M57923</link>
      <description>&lt;P&gt;Not clear what your actual issue is. What is the expected outcome?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max TEST 3 = CALCULATE(DISTINCTCOUNT(TABLE1.FIELD1), FILTER(ALL(TABLE1), TABLE1.DateToCompare &amp;lt;= TABLE1.NonContextDate))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Feb 2022 13:54:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2319922#M57923</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-02-04T13:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Measure context issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2323141#M58059</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;&lt;P&gt;Expected outcome should be for the last row 1 instead of BLANK.any&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NonContextDate&lt;/STRONG&gt; &lt;/EM&gt;= CALCULATE(MAX(ContextDate), ALLSELECTED(TABLE1))&lt;/P&gt;&lt;P&gt;But It seems it ignored the ALLSELECTED within&lt;EM&gt;&lt;STRONG&gt; Max TEST 3&lt;/STRONG&gt;&lt;/EM&gt; measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 13:08:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2323141#M58059</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-07T13:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Measure context issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2336613#M58881</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NonContextDate = CALCULATE(MAX('TABLE1'[Context Date]),ALLSELECTED(TABLE1))&lt;/LI-CODE&gt;
&lt;P&gt;ALLSELECTED will cause some problem if you use it directly. You can try ALL function or you can try this code.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max TEST 3 =
VAR _ADD =
    ADDCOLUMNS ( TABLE1, "NonContextDate", [NonContextDate] )
RETURN
    COUNTAX ( _ADD, [NonContextDate] )&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 10:09:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2336613#M58881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-14T10:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Measure context issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2336614#M58882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NonContextDate = CALCULATE(MAX('TABLE1'[Context Date]),ALLSELECTED(TABLE1))&lt;/LI-CODE&gt;
&lt;P&gt;ALLSELECTED will cause some problem if you use it directly. You can try ALL function or you can try this code.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max TEST 3 =
VAR _ADD =
    ADDCOLUMNS ( TABLE1, "NonContextDate", [NonContextDate] )
RETURN
    COUNTAX ( _ADD, [NonContextDate] )&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 10:09:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-context-issue/m-p/2336614#M58882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-14T10:09:53Z</dc:date>
    </item>
  </channel>
</rss>

