<?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 measure not evaluating to 1? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4240417#M167863</link>
    <description>&lt;P&gt;Hi ALL,&lt;BR /&gt;Firstly&amp;nbsp; Dangar332&amp;nbsp;thank you for your solution!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="801483" data-lia-user-login="VBAmazing" class="lia-mention lia-mention-user"&gt;VBAmazing&lt;/a&gt;&amp;nbsp;,I tried to use your code to run it in the example data I created but he seems to be running fine, since you can't show your example data, can you reproduce your problem based on the pbix file I provided.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can contact me anytime and I will get back to you as soon as I receive your message, looking forward to hearing from you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 02:50:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-10-14T02:50:24Z</dc:date>
    <item>
      <title>Why is my measure not evaluating to 1?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239268#M167731</link>
      <description>&lt;P&gt;Hello Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a series of Measures I am trying to use to identify the first instance of a Customer placing an Order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to accomplish three things:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Identify the Minimum Order Date across a series of dimensions&lt;/LI&gt;&lt;LI&gt;Return "1" for rows where the order falls within the date context&lt;/LI&gt;&lt;LI&gt;Sum all rows where "1" was returned&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I am able to accomplish one and two, but my third Measure is giving unexpected results. Why are the highlighted values appearing as blank?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;img /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;__NewAccounts_A_FirstOrderDate:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;__NewAccounts_A_FirstOrderDate = 

var maxContextDate      = MAX( Dates[Date] )

RETURN
CALCULATE(
    MIN( Sales[Delivery Date] ),
    ALLEXCEPT( 
        'Sales' , 
        Customer[Customer No.], 
        --Customer[Customer], 
        Supplier[Supplier], 
        Location[Branch]
        ),
    Sales[DeliveryDate] &amp;gt;= DATE( YEAR( maxContextDate ) - 1, 1, 1),
    Sales[Delivery Quantity] &amp;gt; 0
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;__NewAccounts_B_FirstOrderInContext:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;__NewAccounts_B_FirstOrderInContext = 
var maxContextDate = MAX( Dates[Date] )

return
    IF(
        [__NewAccounts_A_FirstOrderDate] &amp;gt;= DATE( YEAR( maxContextDate ), 1, 1) &amp;amp;&amp;amp; [__NewAccounts_A_FirstOrderDate] &amp;lt;= maxContextDate,
        1,
        0
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;__NewAccounts_C_DistinctNewCustomers:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;__NewAccounts_C_DistinctNewCustomers = 
 CALCULATE(
    DISTINCTCOUNT( Customer[Customer No.] ),
    FILTER(
        Sales,
        [__NewAccounts_B_FirstOrderInContext] = 1
    )
 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 19:55:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239268#M167731</guid>
      <dc:creator>VBAmazing</dc:creator>
      <dc:date>2024-10-11T19:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my measure not evaluating to 1?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239272#M167732</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="801483" data-lia-user-login="VBAmazing" class="lia-mention lia-mention-user"&gt;VBAmazing&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you provide some sample Data and clarify your scenario in detail.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 20:04:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239272#M167732</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-10-11T20:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my measure not evaluating to 1?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239279#M167736</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569583" data-lia-user-login="Dangar332" class="lia-mention lia-mention-user"&gt;Dangar332&lt;/a&gt;&amp;nbsp;Thank you for your reply. The data is sensitive and unfortunately cannot be shared in a .PBIX, though that would be ideal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the scenario is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I need to identify Customers who placed their first order within one year of the Maximum Context Date&lt;/LI&gt;&lt;LI&gt;I have a measure that correctly identifies the minimum Order Date by Customer (and a few other dimensions)&lt;/LI&gt;&lt;LI&gt;I have another measure that identifies whether that minimum date falls in the desired date context&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now I need to be able to&amp;nbsp;&lt;STRONG&gt;Count the Distinct Customer IDs&lt;/STRONG&gt; where the minimum date falls in the context.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently - as in my screenshot above - You can see those measures in action.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am only able to count the distinct Customer IDs in some of my rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on my current understanding of the logic, I should be getting a 1 in each &lt;STRONG&gt;__NewAccounts_C_DistinctNewCustomers&lt;/STRONG&gt; row where&amp;nbsp;&lt;STRONG&gt;__NewAccounts_B_FirstOrderInContext&lt;/STRONG&gt; is 1, but that's not the case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 20:17:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4239279#M167736</guid>
      <dc:creator>VBAmazing</dc:creator>
      <dc:date>2024-10-11T20:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my measure not evaluating to 1?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4240417#M167863</link>
      <description>&lt;P&gt;Hi ALL,&lt;BR /&gt;Firstly&amp;nbsp; Dangar332&amp;nbsp;thank you for your solution!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="801483" data-lia-user-login="VBAmazing" class="lia-mention lia-mention-user"&gt;VBAmazing&lt;/a&gt;&amp;nbsp;,I tried to use your code to run it in the example data I created but he seems to be running fine, since you can't show your example data, can you reproduce your problem based on the pbix file I provided.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can contact me anytime and I will get back to you as soon as I receive your message, looking forward to hearing from you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 02:50:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-is-my-measure-not-evaluating-to-1/m-p/4240417#M167863</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-14T02:50:24Z</dc:date>
    </item>
  </channel>
</rss>

