<?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: counting records before a specific date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2636571#M77306</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I think You need something similar to this HR blog &lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or check the attached files&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jul 2022 13:53:02 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-07-13T13:53:02Z</dc:date>
    <item>
      <title>counting records before a specific date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2636497#M77297</link>
      <description>&lt;P&gt;I am very new to power Bi and DAX and need help. I have records of dates for when a account was created(Activated Date) for a user. The records go back to 2012. I am showing data for each month of 2022. And I want to show how many people were still active before the last date of each month. I dont want to count people who have a In-Activated date or who have Activated date after the respective month. right now the formula looks like&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'RegisteredUsers'[User Name]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'RegisteredUsers'[In-Activated Date]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"NULL"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 13:25:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2636497#M77297</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-13T13:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: counting records before a specific date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2636571#M77306</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I think You need something similar to this HR blog &lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or check the attached files&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 13:53:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2636571#M77306</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-07-13T13:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: counting records before a specific date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2644276#M77765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I create a sample to have a test.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DimDate table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DimDate = 
ADDCOLUMNS( CALENDAR(DATE(2022,01,01),DATE(2022,12,31)),"Year",YEAR([Date]),"Month",MONTH([Date]),"MonthLongName",FORMAT([Date],"MMMM"))&lt;/LI-CODE&gt;
&lt;P&gt;Please try this code to create a measure to count the active user before each month ending date.&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Active User =
VAR _MAXDATE =
    MAX ( DimDate[Date] )
RETURN
    CALCULATE (
        COUNT ( RegisteredUsers[User Name] ),
        FILTER (
            RegisteredUsers,
            RegisteredUsers[Activated Date] &amp;lt;= _MAXDATE
                &amp;amp;&amp;amp; OR (
                    RegisteredUsers[In-Activated Date] = BLANK (),
                    RegisteredUsers[In-Activated Date] &amp;gt; _MAXDATE
                )
        )
    )&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Mon, 18 Jul 2022 08:47:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/counting-records-before-a-specific-date/m-p/2644276#M77765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-18T08:47:04Z</dc:date>
    </item>
  </channel>
</rss>

