<?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: Adjusting measure to identify changes in FTE value when the role remains the same. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3798446#M148461</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="693492" data-lia-user-login="Oberon" class="lia-mention lia-mention-user"&gt;Oberon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My Sample:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I have a test on myside, I suggest you to try code as below to create a FTE measure directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;M_FTE = 
VAR _RangeStart =
    MIN ( 'Date'[Date] )
VAR _RangeEnd =
    MAX ( 'Date'[Date] )
VAR _Filter1 =
    FILTER (
        ALLSELECTED ( EmploymentHistory ),
        EmploymentHistory[Date] &amp;lt;= _RangeEnd
            &amp;amp;&amp;amp; OR (
                EmploymentHistory[End Date] &amp;gt;= _RangeStart,
                EmploymentHistory[End Date] = BLANK ()
            )
    )
VAR _Filter2 =
    FILTER (
        _Filter1,
        VAR _EMID = [Employee ID]
        VAR _MAXDATE =
            MAXX ( FILTER ( _Filter1, [Employee ID] = _EMID ), [Date] )
        VAR _Role =
            MAXX ( FILTER ( _Filter1, [Employee ID] = _EMID &amp;amp;&amp;amp; [Date] = _MAXDATE ), [Role] )
        RETURN
            [Role] = _Role
    )
RETURN
    SUMX (
        FILTER (
            _Filter2,
            [Employee ID] = MAX ( EmploymentHistory[Employee ID] )
                &amp;amp;&amp;amp; [Role] = MAX ( EmploymentHistory[Role] )
        ),
        [FTE]
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;After May:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Before May:&lt;/SPAN&gt;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Mar 2024 08:54:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-29T08:54:04Z</dc:date>
    <item>
      <title>Adjusting measure to identify changes in FTE value when the role remains the same.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3795324#M148332</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recently had &lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-display-the-most-recent-role-for-a-given-date-range/m-p/3776380" target="_self"&gt;this post&lt;/A&gt; successfully solved. I'm referencing it as the solution has a working PBIX which I can't add. (Too new)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've expanded the logic to my uncleansed data and it worked as intended. I then decided to add FTE data and that highlighted a scenario I hadn't included in my initial request which wasn't calculating as intended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some employees which have a change in FTE values but stay in the same role. In these cases the employees return a 0 in the measure and don't appear before the latest role change and then sum both the FTE values after the latest role change. I can get the FTE to calculate correctly with a measure once it appears but I can't figure out how to modify the measure from the previous solution so they appear before the latest role.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the updated table would look like this:&lt;/P&gt;&lt;P&gt;(Only difference from previous post is that employee B now retains the same 'Role' but moves to 0.6 FTE )&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case I get.&lt;/P&gt;&lt;P&gt;After May:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Before May:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like mentioned above, I can fix the FTE count after May, just not sure how to get an employee to appear before May without ruining the logic for the rest of table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code provided by &lt;SPAN class=""&gt;v-xuxinyi-msft in teh last post to be placed as a visual filter.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Latest Role Filter = 
VAR _MaxDate = CALCULATE(MAX([Date]), FILTER('EmploymentHistory', [Date] &amp;lt;= MAX('Date'[Date]) &amp;amp;&amp;amp; [End Date] &amp;gt; MAX('Date'[Date]) || [Date] &amp;lt;= MAX('Date'[Date]) &amp;amp;&amp;amp; [End Date] = BLANK()))
RETURN
IF(
    SELECTEDVALUE(EmploymentHistory[Employee ID]) = BLANK() &amp;amp;&amp;amp; MAX([Date]) = _MaxDate, 1, IF(
        MAX([Date]) = _MaxDate &amp;amp;&amp;amp; MAX([Employee ID]) = SELECTEDVALUE(EmploymentHistory[Employee ID]), 1, 0)
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone knows how to update the code or can suggest additional measures/columns to get the role appearing before the latest role change it would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 00:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3795324#M148332</guid>
      <dc:creator>Oberon</dc:creator>
      <dc:date>2024-03-28T00:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Adjusting measure to identify changes in FTE value when the role remains the same.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3798446#M148461</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="693492" data-lia-user-login="Oberon" class="lia-mention lia-mention-user"&gt;Oberon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My Sample:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I have a test on myside, I suggest you to try code as below to create a FTE measure directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;M_FTE = 
VAR _RangeStart =
    MIN ( 'Date'[Date] )
VAR _RangeEnd =
    MAX ( 'Date'[Date] )
VAR _Filter1 =
    FILTER (
        ALLSELECTED ( EmploymentHistory ),
        EmploymentHistory[Date] &amp;lt;= _RangeEnd
            &amp;amp;&amp;amp; OR (
                EmploymentHistory[End Date] &amp;gt;= _RangeStart,
                EmploymentHistory[End Date] = BLANK ()
            )
    )
VAR _Filter2 =
    FILTER (
        _Filter1,
        VAR _EMID = [Employee ID]
        VAR _MAXDATE =
            MAXX ( FILTER ( _Filter1, [Employee ID] = _EMID ), [Date] )
        VAR _Role =
            MAXX ( FILTER ( _Filter1, [Employee ID] = _EMID &amp;amp;&amp;amp; [Date] = _MAXDATE ), [Role] )
        RETURN
            [Role] = _Role
    )
RETURN
    SUMX (
        FILTER (
            _Filter2,
            [Employee ID] = MAX ( EmploymentHistory[Employee ID] )
                &amp;amp;&amp;amp; [Role] = MAX ( EmploymentHistory[Role] )
        ),
        [FTE]
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;After May:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Before May:&lt;/SPAN&gt;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 08:54:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3798446#M148461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-29T08:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adjusting measure to identify changes in FTE value when the role remains the same.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3806012#M148827</link>
      <description>&lt;P&gt;Thank you Rico Zhou, this works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone else is looking to run a similar scenario as me and is struggling to finish the last bit where it sums both the part and full time FTE values on the month where the change occurs I added the following to Rico's solution.&lt;/P&gt;&lt;P&gt;Created a calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FT/PT = if([FTE]=1,"FT","PT")&lt;/LI-CODE&gt;&lt;P&gt;Then another 2 measures:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MeasureFTPT = 
LASTNONBLANK(EmploymentHistory[FT/PT],maxx(EmploymentHistory,EmploymentHistory[Employee ID]))&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;M_FTE2 = 
if(
    and([MeasureFTPT] = "PT",[M_FTE] &amp;gt; 1),
    [M_FTE]-1,
    if(
        and([MeasureFTPT] = "FT",[M_FTE] &amp;gt; 1),
        1,
        [M_FTE]
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;Then just use M_FTE2 in place of FTE in the table columns and everything should work.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 22:02:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjusting-measure-to-identify-changes-in-FTE-value-when-the-role/m-p/3806012#M148827</guid>
      <dc:creator>Oberon</dc:creator>
      <dc:date>2024-04-02T22:02:10Z</dc:date>
    </item>
  </channel>
</rss>

