<?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: Need PowerPivot (DAX) measure to determine number of active employees at any point in time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001630#M44444</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
VAR SelectedDate =
    SELECTEDVALUE ( 'Fiscal Calendar'[Date] )
RETURN
    0
        + CALCULATE (
            COUNTROWS ( 'Employee data' ),
            FILTER (
                'Employee data',
                'Employee data'[Employee Status] = "Active"
                    &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= SelectedDate
            )
        )
        + CALCULATE (
            COUNTROWS ( 'Employee data' ),
            FILTER (
                'Employee data',
                'Employee data'[Employee Status] = "Terminated"
                    &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= SelectedDate
                    &amp;amp;&amp;amp; 'Employee data'[Employee Status Date] &amp;gt;= SelectedDate
            )
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Fri, 06 Aug 2021 06:40:36 GMT</pubDate>
    <dc:creator>Jos_Woolley</dc:creator>
    <dc:date>2021-08-06T06:40:36Z</dc:date>
    <item>
      <title>Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001041#M44432</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm able to create the calculation in Excel that returns the number of active employees for any given date. I'm hopeful that there is a way to do this dynamically in PowerPivot so I can return the accurate count regardless of filters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The employee table contains the fields 'Hire Date', 'Employee Status', and 'Status Date' amongst others. So to get the number of active employees for any date the formula would be :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Generic: Active Employees = COUNTIFS([Hire Date], &amp;lt;=&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Selected Date&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt;, [Employee Status] = "Active") + COUNTIFS([Hire Date], &amp;lt;=&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Selected Date&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN&gt;, [Employee Status] = "Terminated", [Status Date] &amp;gt;=&lt;/SPAN&gt;&lt;I&gt;Selected Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actual formula:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;=COUNTIFS(EmpData[[#All],[Hire Date]], "&amp;lt;="&amp;amp;R1, EmpData[[#All],[Employee Status]], "Active") + COUNTIFS(EmpData[[#All],[Hire Date]], "&amp;lt;="&amp;amp;R1, EmpData[[#All],[Employee Status Date]], "&amp;gt;="&amp;amp;R1, EmpData[[#All],[Employee Status]], "Terminated")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also used Sumproduct to get the same result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actual formula:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;=SUMPRODUCT((EmpData[[#All],[Hire Date]]&amp;lt;=R1)*(EmpData[[#All],[Employee Status]]="Active")) + SUMPRODUCT((EmpData[[#All],[Hire Date]]&amp;lt;=R1)*(EmpData[[#All],[Employee Status]]="Terminiated")*(EmpData[[#All],[Employee Status Date]]&amp;gt;=R1))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To break that down, I want a count of the active employees that were hired on or before the selected date, plus the terminated employees that were hired before the comparison date, but not terminated until after the selected date. For the PowerPivot model there are two tables, 'Employee data' and 'Fiscal Calendar'. The selected date will be from the 'Fiscal Calendar'.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts on how to create a measure that will yield the correct results in PowerPivot?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 21:32:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001041#M44432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-05T21:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001496#M44437</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , A measure like this assuming you getting a selected date from date table, not joined with any date &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Active Employees = calculate(distinctCOUNT(EmpData[ID]) , filter(EmpData, (EmpData[Hire Date] &amp;gt;= max(Date[Date]) &amp;amp;&amp;amp; [Employee Status] = "Active" ) &amp;amp;&amp;amp; (&lt;BR /&gt;[Employee Status] = "Terminated" &amp;amp;&amp;amp; EmpData[Hire Date] &amp;lt;= max(Date[Date]))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer if needed&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;</description>
      <pubDate>Fri, 06 Aug 2021 05:57:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001496#M44437</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-08-06T05:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001630#M44444</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
VAR SelectedDate =
    SELECTEDVALUE ( 'Fiscal Calendar'[Date] )
RETURN
    0
        + CALCULATE (
            COUNTROWS ( 'Employee data' ),
            FILTER (
                'Employee data',
                'Employee data'[Employee Status] = "Active"
                    &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= SelectedDate
            )
        )
        + CALCULATE (
            COUNTROWS ( 'Employee data' ),
            FILTER (
                'Employee data',
                'Employee data'[Employee Status] = "Terminated"
                    &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= SelectedDate
                    &amp;amp;&amp;amp; 'Employee data'[Employee Status Date] &amp;gt;= SelectedDate
            )
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 06:40:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2001630#M44444</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-06T06:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2002456#M44461</link>
      <description>&lt;P&gt;Thank you for your prompt response.&amp;nbsp; However, I'm not able to use this approach as SELECTEDVALUE is not an option as a function within Excel/PowerPivot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 13:11:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2002456#M44461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-06T13:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2002798#M44474</link>
      <description>&lt;P&gt;amitchandak,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response.&amp;nbsp; The solution you suggested is an approach that I had tried previously.&amp;nbsp; However, in PowerPivot it only returns the number for the dates in the intersection, not the total number of employees (i.e. for May it should return 15, but only returns 2, the two that had activity in that period).&lt;/P&gt;&lt;P&gt;I was able to get the result I was looking for using my data in PowerBI using the suggestions from your linked referece.&amp;nbsp; However, when I translate that to PowerPivot it does not work correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 16:51:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2002798#M44474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-06T16:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need PowerPivot (DAX) measure to determine number of active employees at any point in time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2003003#M44486</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies, I overlooked that this was for Power Pivot. Try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure :=
0
    + CALCULATE (
        COUNTROWS ( 'Employee data' ),
        FILTER (
            'Employee data',
            'Employee data'[Employee Status] = "Active"
                &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= [Selected Date]
        )
    )
    + CALCULATE (
        COUNTROWS ( 'Employee data' ),
        FILTER (
            'Employee data',
            'Employee data'[Employee Status] = "Terminated"
                &amp;amp;&amp;amp; 'Employee data'[Hire Date] &amp;lt;= [Selected Date]
                &amp;amp;&amp;amp; [Employee Status Date] &amp;gt;= [Selected Date]
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Replace&amp;nbsp;[Selected Date] as meets your requirements.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 19:18:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-PowerPivot-DAX-measure-to-determine-number-of-active/m-p/2003003#M44486</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-06T19:18:17Z</dc:date>
    </item>
  </channel>
</rss>

