<?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: Calculating age at the point in time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4119648#M163560</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="576477" data-lia-user-login="Aleks13311" class="lia-mention lia-mention-user"&gt;Aleks13311&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depend on your descriptions, try to modify your formula like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AdultsUnder65 = 
VAR maxDate = EOMONTH(MAX('Dates Table'[Date]), 0)  // 0 represents the current month
RETURN
    CALCULATE(
        DISTINCTCOUNT('People Table'[PERSON_ID]),
        ALLSELECTED('Dates Table'[Date]),
        'Dates Table'[Date] &amp;lt;= maxDate,
        ISBLANK('People Table'[COMMITMENT_END_DATE]) || 'People Table'[COMMITMENT_END_DATE] &amp;gt;= maxDate,
        DATEDIFF('People Table'[DOB], maxDate, YEAR) &amp;lt; 65
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 02:05:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-27T02:05:25Z</dc:date>
    <item>
      <title>Calculating age at the point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4109034#M163055</link>
      <description>&lt;P&gt;Hi, our data is directly connected to PowerBI, and I don't have access to Power Query. I want to create a line graph showing the trends over time for the number of active customers during a specific period, and how many of those customers were over 65 years old. I have a graph set up as shown below, and the relevant columns in my People Table are: [PERSON_ID], [DOB], [COMMITMENT_START_DATE], and [COMMITMENT_END_DATE].&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I'm using DAX to calculate the number of people:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total Adults = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; maxDate = &lt;/SPAN&gt;&lt;SPAN&gt;EOMONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Dates Table '[Date]), &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;// 0 represents the current month&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &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;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;('People Table '[PERSON_ID]), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;('Dates Table '[Date]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Dates Table'[Date] &amp;lt;= maxDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;('People Table '[COMMITMENT_END_DATE])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; || ''People Table'[COMMITMENT_END_DATE] &amp;gt;= maxDate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I need a DAX formula to calculate the number of people under 65 to include in the graph. I've experimented with various formulas to get the correct count of people under 65, but while it works for the most recent month, it produces incorrect results for dates further back, such as a year ago. One of the DAX formulas I tried is (but it returns inaccurate results):&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Adults Under 65 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; maxDate = &lt;/SPAN&gt;&lt;SPAN&gt;EOMONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Dates Table '[Date]), &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;// 0 represents the current month&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; Under65 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &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;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(People Table [PERSON_ID]), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;('Dates Table '[Date]),&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Dates Table'[Date] &amp;lt;= maxDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(People Table [COMMITMENT_END_DATE])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; || People Table [COMMITMENT_END_DATE] &amp;gt;= maxDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;INT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEARFRAC&lt;/SPAN&gt;&lt;SPAN&gt;(People Table [DOB], maxDate, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)) &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;65&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Under65&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How Can I do it please? Thanks Aleks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 20 Aug 2024 11:03:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4109034#M163055</guid>
      <dc:creator>Aleks13311</dc:creator>
      <dc:date>2024-08-20T11:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age at the point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4109993#M163116</link>
      <description>&lt;P&gt;Are you live connecting to someone else's semantic model?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 00:41:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4109993#M163116</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-08-21T00:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age at the point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4110742#M163145</link>
      <description>&lt;P&gt;Thank you for your response. I'm dealing with a tricky situation. We are currently live-connected to our database, where we record client information, and Power BI is directly connected to this database. Previously, we used an intermediate system to export the data, but that system has been dismantled. As a result, our database engineers opted to connect Power BI directly to the database.&lt;/P&gt;&lt;P&gt;The challenge I'm facing is with calculating the age of customers. When I try to calculate a customer's age, it always reflects their age as of today, since Power BI is pulling real-time data. I haven't been able to find a solution that would allow me to determine how old a person was at a specific point in the past. I can calculate their age on a specific date, but I need a way to calculate their age at any point in time historically.&lt;/P&gt;&lt;P&gt;I'm not sure if I'm explaining this clearly or if what I'm asking for is even possible. Any advice would be greatly appreciated. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 08:35:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4110742#M163145</guid>
      <dc:creator>Aleks13311</dc:creator>
      <dc:date>2024-08-21T08:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age at the point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4119648#M163560</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="576477" data-lia-user-login="Aleks13311" class="lia-mention lia-mention-user"&gt;Aleks13311&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depend on your descriptions, try to modify your formula like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AdultsUnder65 = 
VAR maxDate = EOMONTH(MAX('Dates Table'[Date]), 0)  // 0 represents the current month
RETURN
    CALCULATE(
        DISTINCTCOUNT('People Table'[PERSON_ID]),
        ALLSELECTED('Dates Table'[Date]),
        'Dates Table'[Date] &amp;lt;= maxDate,
        ISBLANK('People Table'[COMMITMENT_END_DATE]) || 'People Table'[COMMITMENT_END_DATE] &amp;gt;= maxDate,
        DATEDIFF('People Table'[DOB], maxDate, YEAR) &amp;lt; 65
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 02:05:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4119648#M163560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-27T02:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age at the point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4125095#M163801</link>
      <description>&lt;P&gt;Thank you so much, it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 13:32:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-age-at-the-point-in-time/m-p/4125095#M163801</guid>
      <dc:creator>Aleks13311</dc:creator>
      <dc:date>2024-08-29T13:32:57Z</dc:date>
    </item>
  </channel>
</rss>

