<?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: Headcount DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125021#M110970</link>
    <description>&lt;P&gt;Also, this is how I have Count of Employees setup:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2023 20:51:46 GMT</pubDate>
    <dc:creator>lunarsoleils</dc:creator>
    <dc:date>2023-03-10T20:51:46Z</dc:date>
    <item>
      <title>Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124607#M110942</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First post and beginner -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an HR Retention Dashboard and am struggling to calculate the Headcount. I have been following some tutorials from&amp;nbsp;&lt;A href="https://www.youtube.com/live/OUsx-byvTWM?feature=share" target="_self"&gt;Solutions Abroad&lt;/A&gt;&amp;nbsp;but my headcount isn't accurate as it is still counting everyone after the date I have selected to filter from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the&amp;nbsp;&lt;A href="https://docs.google.com/spreadsheets/d/17Kf5LXltGaEqT-ggzbrjU_NC9nVsPiBe/edit?usp=sharing&amp;amp;ouid=100121548026267643710&amp;amp;rtpof=true&amp;amp;sd=true" target="_self"&gt;Sample Data&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Headcount = &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;[Count of Employees]&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;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;'Employee Data'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , (&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;'Employee Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Hire/Rehire Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&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; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;'Employee Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Termination Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&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;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Employee Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Termination Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example, when I click January 2022 - it is still counting all of the new hires after that date.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any assistance is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 16:22:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124607#M110942</guid>
      <dc:creator>lunarsoleils</dc:creator>
      <dc:date>2023-03-10T16:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124630#M110943</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="527639" data-lia-user-login="lunarsoleils" class="lia-mention lia-mention-user"&gt;lunarsoleils&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is your 'Employee Data' table connected to your 'Calendar' table (date table) in the model?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I downloaded your sample data, created my own date table, and then created the same measure as shown.&amp;nbsp; But when I select January 2022, the Headcount shows 18.&amp;nbsp; &lt;U&gt;&lt;STRONG&gt;What is the expected result for Headcount in January 2022&lt;/STRONG&gt;&lt;/U&gt;?&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;Also, how is your [Count of Employees] measure defined?&lt;/P&gt;&lt;P&gt;I defined it as follows:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 17:04:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124630#M110943</guid>
      <dc:creator>WinterMist</dc:creator>
      <dc:date>2023-03-10T17:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124857#M110954</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="527639" data-lia-user-login="lunarsoleils" class="lia-mention lia-mention-user"&gt;lunarsoleils&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an additional note, the first part of the filter (as is) will never return results for the given filter context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For example, there are no records in January 2022 where:&lt;/P&gt;&lt;P&gt;- Hire/Rehire Date&amp;nbsp; &amp;lt; 1/1/2022 AND&lt;/P&gt;&lt;P&gt;- Termination Date &amp;gt; 1/31/2022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can probably just remove this piece from the measure.&lt;/P&gt;&lt;P&gt;The entire filter is resting only on the second part:&lt;/P&gt;&lt;P&gt;ISBLANK('Employee Data'[Termination Date].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following shows how the first part of the filter returns no results when the ISBLANK clause is commented out:&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;Regards,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 18:13:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3124857#M110954</guid>
      <dc:creator>WinterMist</dc:creator>
      <dc:date>2023-03-10T18:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125018#M110969</link>
      <description>&lt;P&gt;Hi Nathan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your response, this is how my 'Employee Data' table and 'Calendar' table connected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The expected headcount for January 2022 is 619. Ideally, headcount should include every active employee as of the date selected and exclude anyone who was terminated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you need further information and thank you again for the assistance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 20:50:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125018#M110969</guid>
      <dc:creator>lunarsoleils</dc:creator>
      <dc:date>2023-03-10T20:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125021#M110970</link>
      <description>&lt;P&gt;Also, this is how I have Count of Employees setup:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 20:51:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125021#M110970</guid>
      <dc:creator>lunarsoleils</dc:creator>
      <dc:date>2023-03-10T20:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Headcount DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125087#M110973</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="527639" data-lia-user-login="lunarsoleils" class="lia-mention lia-mention-user"&gt;lunarsoleils&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for providing this information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, you need an active relationship between your 'Employee Data' table &amp;amp; your 'Calendar' table.&amp;nbsp; Currently both of your relationships are inactive (dotted line).&lt;/P&gt;&lt;P&gt;Can you make the relationship with "Hire/Rehire Date" active &amp;amp; leave the "Termination Date" as inactive?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, your definition of active is as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Headcount should include every active employee as of the date selected and exclude anyone who was terminated."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I'm interpreting this log correctly,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;We should include records WHERE :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[Hire/Rehire Date] &amp;lt; MAX('Calendar'[Date])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;BR /&gt;&amp;nbsp; &amp;nbsp;[Termination Date] &amp;gt; MAX('Calendar'[Date]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;OR&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;[Termination Date] IS BLANK&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I do this however, I get a Headcount of 731 for January 2022.&lt;/SPAN&gt;&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I don't have an easy way to verify that this is correct, with so much historic data, so I approached it from a different direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data shows that from 1980 through 2021, there were 732 employees with a Hire/Rehire Date, without any Termination Dates in those years.&lt;/P&gt;&lt;P&gt;If I compare [Count of Employees] to [Headcount] for those years, it matches with 732.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The very first time that a Termination Date appears is in January of 2022.&amp;nbsp; In Jan 2022, there are:&lt;/P&gt;&lt;P&gt;- 22 records for Hire/Rehire Date&lt;/P&gt;&lt;P&gt;- 16 records for Termination Date&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So now if I isolate &lt;U&gt;&lt;STRONG&gt;January 2022&lt;/STRONG&gt;&lt;/U&gt;, I get 731.&amp;nbsp; This seems closer than 619.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you able to verify 100% that 619 is the correct number.&lt;/P&gt;&lt;P&gt;I'm not understanding how this can be correct with what I see in the data.&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 21:55:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headcount-DAX/m-p/3125087#M110973</guid>
      <dc:creator>WinterMist</dc:creator>
      <dc:date>2023-03-10T21:55:20Z</dc:date>
    </item>
  </channel>
</rss>

