<?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 Incorrect measure value with sum of filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499171#M134136</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a measure returning an incorrect result in some cases and I can't figure out why. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(In the following example, i have removed all the non-problematic data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to show amounts owed that were 60 to 90 days old at a date specified by the user. To do that, I use two measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Slicer]&lt;/STRONG&gt; returns the last date on the calendar table based on the value selected by the user on the slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Slicer = MAXX(ALLSELECTED('Calendar'[Date]),[Date])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&lt;STRONG&gt;[60-90 days]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; sums all the Montant_Net (net amount in french sorry) if the Date_Du is 61 and 90 day old based on report date (the date selected by the user and returned by the Slicer Measure).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;60-90 days = CALCULATE(SUM(GL[Montant_Net]), FILTER('GL', DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;gt;=61 &amp;amp;&amp;amp; DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;lt;=90))&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And this is the simplified data where&amp;nbsp;&lt;STRONG&gt;Daysbetween_Slicer_DateDu&lt;/STRONG&gt; is a test measure =&amp;nbsp;&lt;EM&gt;DATEDIFF(GL[Date_Du],[Slicer],DAY).&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example PBIX file:&amp;nbsp;&lt;A title="Example PBIX file" href="https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link" target="_self"&gt;https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In that example, 2023-08-31 is selected by the user on the slicer and the the expected result of&amp;nbsp;&lt;EM&gt;&lt;SPAN&gt;&lt;STRONG&gt;[60-90 days] &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;would be 0 since no entries were between 61 and 90 days old. Yet the measure returns 1 724 625$. Also, I can't explain why but if I edit the measure to&amp;nbsp;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;87 or less, it returns 0.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent a few hours on this issue and tried many things including:&lt;/P&gt;&lt;P&gt;- Using a calculated table instead of a measure&lt;/P&gt;&lt;P&gt;- Changing the type of all my dates to date or date time&lt;/P&gt;&lt;P&gt;- Using AND() instead of &amp;amp;&amp;amp; or using various other syntax instead of DATEDIFF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't understand what's causing this. Any help will be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2023 14:40:30 GMT</pubDate>
    <dc:creator>Camseg</dc:creator>
    <dc:date>2023-10-26T14:40:30Z</dc:date>
    <item>
      <title>Incorrect measure value with sum of filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499171#M134136</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a measure returning an incorrect result in some cases and I can't figure out why. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(In the following example, i have removed all the non-problematic data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to show amounts owed that were 60 to 90 days old at a date specified by the user. To do that, I use two measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Slicer]&lt;/STRONG&gt; returns the last date on the calendar table based on the value selected by the user on the slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Slicer = MAXX(ALLSELECTED('Calendar'[Date]),[Date])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&lt;STRONG&gt;[60-90 days]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; sums all the Montant_Net (net amount in french sorry) if the Date_Du is 61 and 90 day old based on report date (the date selected by the user and returned by the Slicer Measure).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;60-90 days = CALCULATE(SUM(GL[Montant_Net]), FILTER('GL', DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;gt;=61 &amp;amp;&amp;amp; DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;lt;=90))&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And this is the simplified data where&amp;nbsp;&lt;STRONG&gt;Daysbetween_Slicer_DateDu&lt;/STRONG&gt; is a test measure =&amp;nbsp;&lt;EM&gt;DATEDIFF(GL[Date_Du],[Slicer],DAY).&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example PBIX file:&amp;nbsp;&lt;A title="Example PBIX file" href="https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link" target="_self"&gt;https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In that example, 2023-08-31 is selected by the user on the slicer and the the expected result of&amp;nbsp;&lt;EM&gt;&lt;SPAN&gt;&lt;STRONG&gt;[60-90 days] &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;would be 0 since no entries were between 61 and 90 days old. Yet the measure returns 1 724 625$. Also, I can't explain why but if I edit the measure to&amp;nbsp;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;87 or less, it returns 0.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent a few hours on this issue and tried many things including:&lt;/P&gt;&lt;P&gt;- Using a calculated table instead of a measure&lt;/P&gt;&lt;P&gt;- Changing the type of all my dates to date or date time&lt;/P&gt;&lt;P&gt;- Using AND() instead of &amp;amp;&amp;amp; or using various other syntax instead of DATEDIFF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't understand what's causing this. Any help will be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 14:40:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499171#M134136</guid>
      <dc:creator>Camseg</dc:creator>
      <dc:date>2023-10-26T14:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect measure value with sum of filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499186#M134139</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541474" data-lia-user-login="Camseg" class="lia-mention lia-mention-user"&gt;Camseg&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try like:&lt;/P&gt;
&lt;DIV&gt;&lt;SPAN&gt;60&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;90&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;days =&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(GL[Montant_Net]),&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER(&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;ALL&lt;/STRONG&gt;('GL'),&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;gt;=61 &amp;amp;&amp;amp; DATEDIFF(GL[Date_Du],[Slicer],DAY)&amp;lt;=90&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 Oct 2023 14:16:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499186#M134139</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-10-26T14:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect measure value with sum of filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499214#M134144</link>
      <description>&lt;P&gt;Hi! Thank you for your quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result is unchanged with the ALL(). I failed to mention it but I tried various combination of ALL() ALLEXCEPT() ALLSELECTED().&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 14:28:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499214#M134144</guid>
      <dc:creator>Camseg</dc:creator>
      <dc:date>2023-10-26T14:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect measure value with sum of filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499259#M134150</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="541474" data-lia-user-login="Camseg" class="lia-mention lia-mention-user"&gt;Camseg&lt;/a&gt;&amp;nbsp;This works:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;60-90 days NC = 
    VAR __Slicer = MAX('Calendar'[Date])
    VAR __Table = FILTER('GL', DATEDIFF(GL[Date_Du],__Slicer,DAY)&amp;gt;=61 &amp;amp;&amp;amp; DATEDIFF(GL[Date_Du],__Slicer,DAY)&amp;lt;=90)
    VAR __Result = SUMX(__Table, [Montant_Net])
RETURN
    __Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 14:45:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499259#M134150</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-10-26T14:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect measure value with sum of filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499304#M134154</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;, thank you for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It does return 0 but when I add more data (that was hidden for the example) it always return 0 no matter the data.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As an example, here, GL_ID 441977 and 444399 should be included as they are 71 day old.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same example as before but with more data:&lt;/P&gt;&lt;P&gt;&lt;A title="Example with more data" href="https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link" target="_self"&gt;https://drive.google.com/file/d/1j4i6j7AZnXtm_S_x91dd2uorg2cxaxjH/view?usp=drive_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 15:03:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-measure-value-with-sum-of-filter/m-p/3499304#M134154</guid>
      <dc:creator>Camseg</dc:creator>
      <dc:date>2023-10-26T15:03:11Z</dc:date>
    </item>
  </channel>
</rss>

