<?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: How to calculate YTD values of only for active employees at that time. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2264602#M54828</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;If I understand you correctly, you want to modify the existing &lt;STRONG&gt;YTD_Vac&lt;/STRONG&gt; measure so that only Employees who have not resigned as at the currently filtered date are included.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this by adding an additional filter such that Date_Resign is either blank or greater than the "currently filtered date".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can choose how to define "currently filtered date", but I'm going to use the maximum visible date in the filter context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With these assumptions, you could write a measure like this, making use of the existing &lt;STRONG&gt;YTD_Vac&lt;/STRONG&gt; measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD_Vac for employees not yet resigned = 
VAR MaxDate =
    MAX ( Dim_Calendar[Cal_Date] )
RETURN
    CALCULATE ( 
        [YTD_Vac],
        KEEPFILTERS (
            OR (
                ISBLANK ( Dim_EmpInfo[Date_Resign] ),
                Dim_EmpInfo[Date_Resign] &amp;gt; MaxDate
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also combine the logic into one measure (assuming can reference the &lt;STRONG&gt;Sum_Vac &lt;/STRONG&gt;measure):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD_Vac for employees not yet resigned = 
VAR MaxDate =
    MAX ( Dim_Calendar[Cal_Date] )
RETURN
    CALCULATE ( 
        [Sum_Vac],
        DATESYTD ( 'Dim_Calendar'[Cal_Date] ),
        KEEPFILTERS (
            OR (
                ISBLANK ( Dim_EmpInfo[Date_Resign] ),
                Dim_EmpInfo[Date_Resign] &amp;gt; MaxDate
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notes on the above:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I suggest using KEEPFILTERS to ensure that we combine the Date_Resign filter with any existing filters on Date_Resign that might exist.&lt;/LI&gt;
&lt;LI&gt;By using the condition that &lt;STRONG&gt;Date_Resign &amp;gt; MaxDate&lt;/STRONG&gt;, we exclude any Employees who resigned before/during the currently filtered period. For example, if you displayed this measure by month rather than date, you would only include Employees whose &lt;STRONG&gt;Date_Resign&lt;/STRONG&gt; is after the filtered month (or blank).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Hopefully the above is useful and can be adapted to your model, but please post back if needed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 02:45:52 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2022-01-04T02:45:52Z</dc:date>
    <item>
      <title>How to calculate YTD values of only for active employees at that time.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2264563#M54826</link>
      <description>&lt;P&gt;Hi, Happy New year!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get a solution for my model.&lt;/P&gt;&lt;P&gt;I assumed that the solution I want is about Semi-additive calculations. but it was different.&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I referenced this article from &lt;A href="https://www.daxpatterns.com/semi-additive-calculations/" target="_self"&gt;"daxpatterns.com"&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, If you can help me, I really appreciate that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a description of the question.&lt;/P&gt;&lt;P&gt;* Purpose: Usage status management of vacations&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;* Desired Result (Measure): YTD Number of used vacations at each time point (only for active employees at that time)&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;- You can check the Desired result from the underneath table.&lt;/P&gt;&lt;P&gt;* My model is here&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* Here is the result table. and two measures(Columns) are like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Sum_Vac : Sum( 'Fact_Vacation'[#ofDays] )&lt;BR /&gt;- YTD_Vac : Calculate ( 'Fact_Vacation'[#ofDays], DATESYTD ('DIM_Calendar'[Cal_Date]) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I want to get a measure for "Desired Result".&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The important point for measure("Desired Result") is&lt;BR /&gt;after employee resigned (for this example: Emp_ID is "A120"),&lt;BR /&gt;the values that the resigned employee had used until 11, Oct 2019 should be extracted from "Desired Result" in columns "H" and "K".&lt;BR /&gt;Therefore, From 12, Oct 2019, the outstanding values for the active employees (for this example: Emp_ID is "A115") should be remaining.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need detailed data about it, I surely give it to you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Actually, I could not find the way of attaching files)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need additional explanations or Sources about this, please feel free to contact me.&lt;/P&gt;&lt;P&gt;And any recommendations about articles related to this concept are always welcome.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 01:49:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2264563#M54826</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-04T01:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate YTD values of only for active employees at that time.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2264602#M54828</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;If I understand you correctly, you want to modify the existing &lt;STRONG&gt;YTD_Vac&lt;/STRONG&gt; measure so that only Employees who have not resigned as at the currently filtered date are included.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this by adding an additional filter such that Date_Resign is either blank or greater than the "currently filtered date".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can choose how to define "currently filtered date", but I'm going to use the maximum visible date in the filter context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With these assumptions, you could write a measure like this, making use of the existing &lt;STRONG&gt;YTD_Vac&lt;/STRONG&gt; measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD_Vac for employees not yet resigned = 
VAR MaxDate =
    MAX ( Dim_Calendar[Cal_Date] )
RETURN
    CALCULATE ( 
        [YTD_Vac],
        KEEPFILTERS (
            OR (
                ISBLANK ( Dim_EmpInfo[Date_Resign] ),
                Dim_EmpInfo[Date_Resign] &amp;gt; MaxDate
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also combine the logic into one measure (assuming can reference the &lt;STRONG&gt;Sum_Vac &lt;/STRONG&gt;measure):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YTD_Vac for employees not yet resigned = 
VAR MaxDate =
    MAX ( Dim_Calendar[Cal_Date] )
RETURN
    CALCULATE ( 
        [Sum_Vac],
        DATESYTD ( 'Dim_Calendar'[Cal_Date] ),
        KEEPFILTERS (
            OR (
                ISBLANK ( Dim_EmpInfo[Date_Resign] ),
                Dim_EmpInfo[Date_Resign] &amp;gt; MaxDate
            )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notes on the above:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I suggest using KEEPFILTERS to ensure that we combine the Date_Resign filter with any existing filters on Date_Resign that might exist.&lt;/LI&gt;
&lt;LI&gt;By using the condition that &lt;STRONG&gt;Date_Resign &amp;gt; MaxDate&lt;/STRONG&gt;, we exclude any Employees who resigned before/during the currently filtered period. For example, if you displayed this measure by month rather than date, you would only include Employees whose &lt;STRONG&gt;Date_Resign&lt;/STRONG&gt; is after the filtered month (or blank).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Hopefully the above is useful and can be adapted to your model, but please post back if needed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 02:45:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2264602#M54828</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2022-01-04T02:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate YTD values of only for active employees at that time.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2265196#M54848</link>
      <description>&lt;P&gt;Thank you!!! Owen,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It nicely worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You inspired me with a good answer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nash&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 09:53:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-YTD-values-of-only-for-active-employees-at-that/m-p/2265196#M54848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-04T09:53:42Z</dc:date>
    </item>
  </channel>
</rss>

