<?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: Identifying if a Record has ended using start and end dates of table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2649731#M78080</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;I suggest you to try this code to create a calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag =
VAR _COUNT =
    CALCULATE (
        COUNT ( Employee[Employee ID] ),
        ALLEXCEPT ( Employee, Employee[Employee ID] )
    )
VAR _NEXTSTARTDATE =
    CALCULATE (
        MIN ( Employee[Start Date] ),
        FILTER (
            ALLEXCEPT ( Employee, Employee[Employee ID] ),
            Employee[Start Date] &amp;gt; EARLIER ( Employee[End Date] )
        )
    )
VAR _DATEDIFF =
    DATEDIFF ( Employee[End Date], _NEXTSTARTDATE, DAY )
RETURN
    IF (
        _COUNT = 1,
        IF ( Employee[End Date] = BLANK (), BLANK (), "Left organization" ),
        IF ( _DATEDIFF &amp;lt; 14, BLANK (), "Left organization" )
    )&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;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>Wed, 20 Jul 2022 08:35:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-07-20T08:35:03Z</dc:date>
    <item>
      <title>Identifying if a Record has ended using start and end dates of table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2643273#M77713</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to PowerBi and am trying to identify if an employee has left the organization vs those that have transferred roles. My table contains the employee ID, job code, start date for that role and end date for that role where the end date is blank if they are a current employee.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use Dax to add an additional column to label all terminated employees - these are employees no longer with the company or have left and returned more than 14 days after the end date of the role..&amp;nbsp; I have attached table of with a sample of data.&amp;nbsp; Where 'expected Values' si what I'm hopgin to use my Dax formula with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my example,Employee 1 has transferred to a new role effective April 5th(end date of previous role was on Friday and they start the new role on Monday).&amp;nbsp; So even though Line 1 has an end date, I do not want them to be labelled as terminated.&amp;nbsp; However,&amp;nbsp; Because employee 2 ended on March 31, 2021 and came back the next year, they should be considered terminated effective march 31, 2021.&amp;nbsp; (The buffer period between the end date of one line and start date of another line for the same employee should be 14 days).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Employee ID&lt;/TD&gt;&lt;TD&gt;Job Code&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;End Date&lt;/TD&gt;&lt;TD&gt;Expected Values&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;TD&gt;4/2/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;4/5/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2/2/2021&lt;/TD&gt;&lt;TD&gt;3/31/2021&lt;/TD&gt;&lt;TD&gt;Left Organization&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;1/1/2022&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2/1/2021&lt;/TD&gt;&lt;TD&gt;3/31/2022&lt;/TD&gt;&lt;TD&gt;Left Organization&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2/2/2022&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping Someone will be able to help me.&amp;nbsp; Thanks in Advance!&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2022 22:58:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2643273#M77713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-17T22:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying if a Record has ended using start and end dates of table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2644643#M77781</link>
      <description>&lt;P&gt;You can try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Left company =
VAR currentEmployeeID = 'Employee'[Employee ID]
VAR currentEndDate = 'Employee'[End Date]
VAR futureJobs =
    FILTER (
        'Employee',
        'Employee'[ID] = currentEmployeeID
            &amp;amp;&amp;amp; 'Employee'[Start Date] &amp;lt;= currentEndDate + 14
    )
RETURN
    IF (
        NOT ( ISBLANK ( currentEndDate ) ) &amp;amp;&amp;amp; ISEMPTY ( futureJobs ),
        "Left organization"
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Jul 2022 10:54:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2644643#M77781</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-07-18T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying if a Record has ended using start and end dates of table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2649731#M78080</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;I suggest you to try this code to create a calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag =
VAR _COUNT =
    CALCULATE (
        COUNT ( Employee[Employee ID] ),
        ALLEXCEPT ( Employee, Employee[Employee ID] )
    )
VAR _NEXTSTARTDATE =
    CALCULATE (
        MIN ( Employee[Start Date] ),
        FILTER (
            ALLEXCEPT ( Employee, Employee[Employee ID] ),
            Employee[Start Date] &amp;gt; EARLIER ( Employee[End Date] )
        )
    )
VAR _DATEDIFF =
    DATEDIFF ( Employee[End Date], _NEXTSTARTDATE, DAY )
RETURN
    IF (
        _COUNT = 1,
        IF ( Employee[End Date] = BLANK (), BLANK (), "Left organization" ),
        IF ( _DATEDIFF &amp;lt; 14, BLANK (), "Left organization" )
    )&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;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>Wed, 20 Jul 2022 08:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2649731#M78080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-20T08:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying if a Record has ended using start and end dates of table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2657225#M78627</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;Anonymous&lt;/LI-USER&gt;!&amp;nbsp; I jsut tested this and it does what I needed!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 01:54:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identifying-if-a-Record-has-ended-using-start-and-end-dates-of/m-p/2657225#M78627</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-24T01:54:32Z</dc:date>
    </item>
  </channel>
</rss>

