<?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: Employee Turnover Based on Month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3928141#M152834</link>
    <description>&lt;P&gt;Hi Xifeng,&lt;/P&gt;&lt;P&gt;Note exactly I suppose what I was trying to do with the calculation was if we for example take a year to date view, the calulcation would take me leavers, then divide by the distinct count of each period. It would besically allow me to see a true headcount each month.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 17:16:52 GMT</pubDate>
    <dc:creator>Andonip</dc:creator>
    <dc:date>2024-05-17T17:16:52Z</dc:date>
    <item>
      <title>Employee Turnover Based on Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3927714#M152798</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New user here and trying to build out our Employee Turnover figure. Usually in excel we have a view per month, the takes the date of the month and employee ID, so we can monitor month-on-month changes of various demographics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now my data set looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;Employee ID&lt;/TD&gt;&lt;TD&gt;First Name&lt;/TD&gt;&lt;TD&gt;Last Name&lt;/TD&gt;&lt;TD&gt;Department&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;Smith&lt;/TD&gt;&lt;TD&gt;Finance&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;444&lt;/TD&gt;&lt;TD&gt;Jane&lt;/TD&gt;&lt;TD&gt;Doe&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;668&lt;/TD&gt;&lt;TD&gt;Bruce&lt;/TD&gt;&lt;TD&gt;Wayne&lt;/TD&gt;&lt;TD&gt;Customer Support&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;Smith&lt;/TD&gt;&lt;TD&gt;Tax&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;444&lt;/TD&gt;&lt;TD&gt;Jane&lt;/TD&gt;&lt;TD&gt;Doe&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;668&lt;/TD&gt;&lt;TD&gt;Bruce&lt;/TD&gt;&lt;TD&gt;Wayne&lt;/TD&gt;&lt;TD&gt;Customer Support&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i find though is that my formula does no recognise the employee ID per period:&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;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Attrition HC'&lt;/SPAN&gt;&lt;SPAN&gt;[Employee ID]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Attrition HC'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Attrition HC'&lt;/SPAN&gt;&lt;SPAN&gt;[Period]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So as a result, I am just counting everyone once rather than per month. Is this normal behaviour or is there something i can do to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ap&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 13:59:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3927714#M152798</guid>
      <dc:creator>Andonip</dc:creator>
      <dc:date>2024-05-17T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Employee Turnover Based on Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3927920#M152815</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="744978" data-lia-user-login="Andonip" class="lia-mention lia-mention-user"&gt;Andonip&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the following result what you want?&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;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 15:28:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3927920#M152815</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-05-17T15:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Employee Turnover Based on Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3928141#M152834</link>
      <description>&lt;P&gt;Hi Xifeng,&lt;/P&gt;&lt;P&gt;Note exactly I suppose what I was trying to do with the calculation was if we for example take a year to date view, the calulcation would take me leavers, then divide by the distinct count of each period. It would besically allow me to see a true headcount each month.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 17:16:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3928141#M152834</guid>
      <dc:creator>Andonip</dc:creator>
      <dc:date>2024-05-17T17:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Employee Turnover Based on Month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3933957#M153049</link>
      <description>&lt;P&gt;Thanks for the reply from&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="738384" data-lia-user-login="xifeng_L" class="lia-mention lia-mention-user"&gt;xifeng_L&lt;/a&gt;,&lt;SPAN&gt;, please allow me to provide another insight:&lt;/SPAN&gt;&lt;BR /&gt;Hi,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="744978" data-lia-user-login="Andonip" class="lia-mention lia-mention-user"&gt;Andonip&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your first requirement, my understanding is that you need to group by each different period and calculate the number of people who always have a few different employee ids in each period:&lt;/P&gt;
&lt;P&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P&gt;1.First I have created the following table and the column names and data are the data you have given:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Below are the measure I've created for your needs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;headcount = CALCULATE(DISTINCTCOUNT('Attrition HC'[Employee ID]),FILTER(ALLSELECTED('Attrition HC'),'Attrition HC'[Period]=MAX('Attrition HC'[Period])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Allselected() function retains, the filtering conditions that you grouped with the Max() function, thus satisfying your need to count once per period, rather than once per person.&lt;BR /&gt;Below is the content of the relevant documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allselected-function-dax" target="_blank"&gt;ALLSELECTED function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3.Here's my final result, which I hope meets your requirements.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;4.Secondly regarding your desire to count all the people and then divide by a different number of people in each period, my measure is as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = DIVIDE(CALCULATE(DISTINCTCOUNT('Attrition HC'[Employee ID]),FILTER(ALLSELECTED('Attrition HC'),'Attrition HC'[DATE]&amp;gt;=DATE(2024,1,1)&amp;amp;&amp;amp;'Attrition HC'[DATE]&amp;lt;=TODAY())),
CALCULATE(DISTINCTCOUNT('Attrition HC'[Employee ID]),FILTER(ALLSELECTED('Attrition HC'),'Attrition HC'[Period]=MAX('Attrition HC'[Period]))))
&lt;/LI-CODE&gt;
&lt;P&gt;5.My end result is 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;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Leroy Lu&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider Accept it &lt;STRONG&gt;&lt;EM&gt;as the solution &lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 03:10:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Employee-Turnover-Based-on-Month/m-p/3933957#M153049</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-21T03:10:02Z</dc:date>
    </item>
  </channel>
</rss>

