<?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: Date Measures are not adding up to total value, not sure why in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2599895#M75116</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&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;Thanks for your help but both are getting errors, it says unexpected tuple in both of them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 08:21:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-24T08:21:16Z</dc:date>
    <item>
      <title>Date Measures are not adding up to total value, not sure why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2598920#M75060</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have two measures that count ID's from two different timescales one that counts the last 30 days from now, and another that counts 30-90 days. However, the 30-90 days isn't adding up correctly, and I'm not sure why, as shown below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have the date filtered from the last 90 days. If you add up the last 30 days, and last 30 to 90 days, it should be the exact same value as the User Count, yet it's much bigger and I don't understand why. Here's the code for the three measures:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;User Count = DISTINCTCOUNT('Candidate Activity'[userid])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last 30 days =
CALCULATE (
(DISTINCTCOUNT('Candidate Activity'[userid]),
DATESINPERIOD ( 'Candidate Activity'[active_date], MAX ( 'Candidate Activity'[active_date] ), -30, DAY )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last 30 to 90 Days =
var lstdate = LASTDATE('Candidate Activity'[active_date])
var lstdateless90 = lstdate -90
var lstdateless30 = lstdate -30
return
CALCULATE([User Count], DATESBETWEEN(Dates[Date], lstdateless90, lstdateless30))
 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;So the date that is being filtered is a column called [active_date] which is used in a date table as shown below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for that date table below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE('Candidate Activity'[active_date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm unsure why it's not being calculated correctly, is there something I'm doing wrong here? Because I'm completely at a loss. Any help would be greatly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 21:57:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2598920#M75060</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-23T21:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date Measures are not adding up to total value, not sure why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2599389#M75098</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , Not very clear. Try measure in one of the following &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 30 to 90 days =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;(DISTINCTCOUNT('Candidate Activity'[userid]),&lt;BR /&gt;DATESINPERIOD ( 'Candidate Activity'[active_date], MAX ( 'Candidate Activity'[active_date] )-30, -60, DAY )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 31 to 90 days =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;(DISTINCTCOUNT('Candidate Activity'[userid]),&lt;BR /&gt;DATESINPERIOD ( 'Candidate Activity'[active_date], MAX ( 'Candidate Activity'[active_date] )-31, -60, DAY )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 05:29:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2599389#M75098</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-06-24T05:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Date Measures are not adding up to total value, not sure why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2599895#M75116</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&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;Thanks for your help but both are getting errors, it says unexpected tuple in both of them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 08:21:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2599895#M75116</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T08:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Date Measures are not adding up to total value, not sure why</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2608218#M75550</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;This may be related to your data.&lt;/P&gt;
&lt;P&gt;If your table has dates 2022.1.1 – 2022.4.1.&lt;/P&gt;
&lt;P&gt;[User Count] is to count all the data without duplicates in the entire table, such as A, B, C, D, E.&lt;/P&gt;
&lt;P&gt;[Last 30 days] is to count the data without duplicates in the table from 2022.3.2 - 2022.4.1, such as A, B, C.&lt;/P&gt;
&lt;P&gt;[Last 30 - 90days] is to count the data without duplicates in the table from 2022.1.1 - 2022.3.2, such as A, D, E.&lt;/P&gt;
&lt;P&gt;If all three measures have an A when they are counted, they will be counted as the individual of the three measures, not equivalent to a whole with only one A.&lt;/P&gt;
&lt;P&gt;So [Last 30 days]+ [Last 30 - 90days] =6 &amp;gt;[User Count]=5.&lt;/P&gt;
&lt;P&gt;If you change the function to Count, they add up to the same.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last 30 to 90 Days =
var _lastdate = LASTDATE('Candidate Activity'[actrive_date])
return
CALCULATE(COUNT('Candidate Activity'[userid]),FILTER(ALL('Candidate Activity'),
'Candidate Activity'[actrive_date]&amp;gt;=
DATE(YEAR(_lastdate),MONTH(_lastdate),DAY(_lastdate)-90)&amp;amp;&amp;amp;'Candidate Activity'[actrive_date]&amp;lt;DATE(YEAR(_lastdate),MONTH(_lastdate),DAY(_lastdate)-30)
))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Last 30 Days =
var _lastdate = LASTDATE('Candidate Activity'[actrive_date])
return
CALCULATE(COUNT('Candidate Activity'[userid]),FILTER(ALL('Candidate Activity'),
'Candidate Activity'[actrive_date]&amp;gt;=
DATE(YEAR(_lastdate),MONTH(_lastdate),DAY(_lastdate)-30)&amp;amp;&amp;amp;'Candidate Activity'[actrive_date]&amp;lt;=_lastdate)
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;User Count = COUNT('Candidate Activity'[userid])&lt;/LI-CODE&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 03:09:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Measures-are-not-adding-up-to-total-value-not-sure-why/m-p/2608218#M75550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-29T03:09:43Z</dc:date>
    </item>
  </channel>
</rss>

