<?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: Number of users active in a selected date (with start date and end date) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-users-active-in-a-selected-date-with-start-date-and/m-p/3259477#M120477</link>
    <description>&lt;P&gt;Do you have any relationships between either of the calendar tables and the WorkDayGlobal table ?&lt;/P&gt;</description>
    <pubDate>Tue, 30 May 2023 11:01:14 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-05-30T11:01:14Z</dc:date>
    <item>
      <title>Number of users active in a selected date (with start date and end date)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-users-active-in-a-selected-date-with-start-date-and/m-p/3257998#M120389</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I require assistance with some Power BI measures. I'm trying to determine the number of active employees within a selected timeframe based on the "Date" (contract start date) and "EndDate" (contract end date) fields. Blank values in the "Date" field indicate that the employee was already active when data collection began, while empty values in the "EndDate" field signify that the employee is presently active. Whenever an employee gets promoted, their record is updated with an "EndDate" value, and a new entry is created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The objective is to allow the end user to select two separate periods using slicers and view a detailed table showing which employees are new or no longer employed by the company. To facilitate this, I have duplicated the calendar table.&lt;/P&gt;&lt;P&gt;The measures I have created are as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Employees_FirstMonthSelected: This measure calculates the count of active employees in the first selected month.&lt;BR /&gt;&lt;SPAN&gt;Employees_FirstMonthSelected =&lt;BR /&gt;&lt;/SPAN&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;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;0&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;SPAN&gt;AND&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;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &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; &lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[EndDate]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[EndDate]&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;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;Employees_SecondMonthSelected: This measure calculates the count of active employees in the second selected month.&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Employees_SecondMonthSelected =&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Max_Date&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar2'&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;RETURN&lt;/SPAN&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;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;0&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;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;Max_Date&lt;/SPAN&gt;&lt;SPAN&gt; || &lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&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; &lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[EndDate]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; Max_Date&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;|| &lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;WorkDayGlobal&lt;/SPAN&gt;&lt;SPAN&gt;[EndDate]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The issue I'm facing is that when I generate a detailed table of employees, some of them do not appear as active in periods when they were actually active (verified in the WorkdayGlobal table). For instance, if the user selects January 2023 and May 2023, an employee who worked from September 13, 2022, to April 11, 2023, and had a contract change with a start date of April 11 without an end date, should be considered active in both January 2023 and May 2023. However, they only appear as active in January.&lt;/P&gt;&lt;P&gt;I would greatly appreciate any insights on why this might be happening.&lt;/P&gt;&lt;P&gt;Thank you for your assistance.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 29 May 2023 13:03:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-users-active-in-a-selected-date-with-start-date-and/m-p/3257998#M120389</guid>
      <dc:creator>SCTomas92</dc:creator>
      <dc:date>2023-05-29T13:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Number of users active in a selected date (with start date and end date)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-users-active-in-a-selected-date-with-start-date-and/m-p/3259477#M120477</link>
      <description>&lt;P&gt;Do you have any relationships between either of the calendar tables and the WorkDayGlobal table ?&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 11:01:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-users-active-in-a-selected-date-with-start-date-and/m-p/3259477#M120477</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-05-30T11:01:14Z</dc:date>
    </item>
  </channel>
</rss>

