<?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 Average experience by employee in DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1660877#M33859</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple (virtual) table in my data model, showing 3 columns:&lt;/P&gt;&lt;P&gt;employee number // employment date // date of dismissal&lt;/P&gt;&lt;P&gt;I have as wll another (virtual) table with callendar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a measure showing average number of days the employees stayed with us at a given date (year and month ends). this equals to total sum of days between employment and given date for all employees, dividing by total number of employees.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built the measure but it does not work as expected. the nominator (total number of days active employees worked at given date) shows correct igures per employee, but total for year looks weared. for instance - I ger 8220 ttoal for Dec 2013, while there are over 200 employees, many of them working over 8000 days for the company. what do I mess in the below measure to assure total per date is correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Average Experience = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var maxDate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;max(CALLENDAR[Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var daysbetween = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;calculate(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;datediff(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;min(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Experience Tab'[EMPLOYED]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;maxDate,DAY&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Experience Tab'[EMPLOYED]&amp;lt;maxDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;('Experience Tab'[DISMISSED] &amp;gt; maxDate || ISBLANK('Experience Tab'[DISMISSED])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;daysbetween&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 11 Feb 2021 15:08:44 GMT</pubDate>
    <dc:creator>Draszor</dc:creator>
    <dc:date>2021-02-11T15:08:44Z</dc:date>
    <item>
      <title>Average experience by employee in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1660877#M33859</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple (virtual) table in my data model, showing 3 columns:&lt;/P&gt;&lt;P&gt;employee number // employment date // date of dismissal&lt;/P&gt;&lt;P&gt;I have as wll another (virtual) table with callendar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a measure showing average number of days the employees stayed with us at a given date (year and month ends). this equals to total sum of days between employment and given date for all employees, dividing by total number of employees.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built the measure but it does not work as expected. the nominator (total number of days active employees worked at given date) shows correct igures per employee, but total for year looks weared. for instance - I ger 8220 ttoal for Dec 2013, while there are over 200 employees, many of them working over 8000 days for the company. what do I mess in the below measure to assure total per date is correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Average Experience = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var maxDate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;max(CALLENDAR[Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var daysbetween = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;calculate(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;datediff(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;min(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Experience Tab'[EMPLOYED]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;maxDate,DAY&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Experience Tab'[EMPLOYED]&amp;lt;maxDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;('Experience Tab'[DISMISSED] &amp;gt; maxDate || ISBLANK('Experience Tab'[DISMISSED])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;daysbetween&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Feb 2021 15:08:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1660877#M33859</guid>
      <dc:creator>Draszor</dc:creator>
      <dc:date>2021-02-11T15:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Average experience by employee in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1661231#M33872</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="227965" data-lia-user-login="Draszor" class="lia-mention lia-mention-user"&gt;Draszor&lt;/a&gt; , Try a measure like &lt;/P&gt;
&lt;P&gt;divide(sumx(Table, datediff(Table[employment date], coalesce(Table[date of dismissal], today()), day)), count(Table[employee number]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is Avg in Days&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 17:32:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1661231#M33872</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-02-11T17:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Average experience by employee in DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1664703#M33981</link>
      <description>&lt;P&gt;thank you amitchandak,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your idea but had to modify it, as my goal was to plot the average experience into the time line, showing what is the average working period in the company, per year. if most experienced people leave, the average drops. if new-comers leave, average increases. in both cases the turnover ratio could be the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first, I had to redo my data model, resigning from my virtual table that was showing emloyee / date of employment / date of release - REASON - using this table in the nominator of DIVIDE(), it was giving the correct results for the total company, but I was not able to filter by any aggregate (unfortunatelly I work on one table of HC_DATA, not on the fact table and the lookup table),&lt;/P&gt;&lt;P&gt;my working formula for the nominator of my DIVIDE() in short is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Var ExperienceDays = 
calculate(
    sumx(
        HC_DATA,
        DATEDIFF(HC_DATA[employed at],
        COALESCE(maxDate,
        HC_DATA[released at]
        ),
        DAY
        )
    ),
    ALLEXCEPT(HC_DATA,
    HC_DATA[Emp no SAP],HC_DATA[AGGR_0],HC_DATA[Name],HC_DATA[Surname],HC_DATA[Aggr_1],HC_DATA[Aggr_2],HC_DATA[Org_Unit_1],HC_DATA[Org_Unit_2],HC_DATA[Org_Unit_3],HC_DATA[Wydział]
    ),
   
    HC_DATA[Employed at] &amp;lt;= maxDate,
    (HC_DATA[Released at]&amp;gt;maxDate || ISBLANK(HC_DATA[Released at])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;one weird issue I observe is the must to keep the ALLEXCEPT() inside the formula. without it, my total days are much lower than they should.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 20:29:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-experience-by-employee-in-DAX/m-p/1664703#M33981</guid>
      <dc:creator>Draszor</dc:creator>
      <dc:date>2021-02-13T20:29:03Z</dc:date>
    </item>
  </channel>
</rss>

