<?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: Last working day vs variable Date field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782455#M1209659</link>
    <description>&lt;P&gt;You're very welcome!&lt;/P&gt;</description>
    <pubDate>Sat, 13 Feb 2021 00:38:55 GMT</pubDate>
    <dc:creator>Martijn_W</dc:creator>
    <dc:date>2021-02-13T00:38:55Z</dc:date>
    <item>
      <title>Last working day vs variable Date field</title>
      <link>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782385#M1209643</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a database coming from a time clock tool to determine how many employees there are in a compagny at a selected period.&lt;/P&gt;&lt;P&gt;Below are data coming out from the database&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date of working&lt;/P&gt;&lt;P&gt;Nom&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name of the employee&lt;/P&gt;&lt;P&gt;SectionCode&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specific codification&lt;/P&gt;&lt;P&gt;Date entrée&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date when the employee started working in the compagny&lt;/P&gt;&lt;P&gt;Date sortie&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date when the employee left the compagny. Please note this field is never empty : either it is filed with the actual leaving date if the employee already left, either it is filed with '31/12/2050' as a fake leaving date if the employee is still working in the compagny&lt;/P&gt;&lt;P&gt;Total&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hours worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to determine on a monthly basis the number of employee per section code. The rule to apply is the following&amp;nbsp;:&lt;/P&gt;&lt;P&gt;If an employee did not leave the compagny the last working day of the month, then is it counted as present. On the other hand if he leaves the compagny in 02/02/2021, it should not be counted in february.&lt;/P&gt;&lt;P&gt;I managed to get this right in a table first by setting up a new variable to get the last day of the month :&lt;/P&gt;&lt;P&gt;LastWorkDate(Date, NetWorkDays(Date, MonthEnd(Date))) as [Month end];&lt;/P&gt;&lt;P&gt;Then using IF formulas&amp;nbsp;:&amp;nbsp;«&amp;nbsp;If([Date sortie]&amp;lt;&amp;gt;'31/12/2050' AND [Date sortie]&amp;gt;= [Month end] AND [Date entrée]&amp;gt;=[Month end],0,1).&lt;/P&gt;&lt;P&gt;For instance, in below table : If October 2020 is selected, Gregory is not counted in the employees as he will only be hired in 15/11/2020 and manon is counted in as she will only leave in December.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Meanwhile, when i try to sum this up in a table showing only SectionCode, i got lost summing up the lines. i shall get 4 as a results but i can't get it right.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.JPG" style="width: 728px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/48998i30806362EFAB8BF9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excel and qvw files attached for those who wants to help&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 19:11:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782385#M1209643</guid>
      <dc:creator>guillaume_gorli</dc:creator>
      <dc:date>2021-02-12T19:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last working day vs variable Date field</title>
      <link>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782446#M1209654</link>
      <description>&lt;P&gt;Hi Guillaume,&lt;/P&gt;&lt;P&gt;So your objective is to do a proper headcount with the requirement that employees should only count if they work the full month, correct?&lt;BR /&gt;&lt;BR /&gt;Considering that, in your model, you already keep a fact table with a date row for each employee/date combination, the easiest way and most efficient way is to use the script to evaluate each day. Look at the very tiny adjustment I made to your sample file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 23:30:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782446#M1209654</guid>
      <dc:creator>Martijn_W</dc:creator>
      <dc:date>2021-02-12T23:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Last working day vs variable Date field</title>
      <link>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782449#M1209655</link>
      <description>&lt;P&gt;Thanks a lot Martijin for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 00:07:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782449#M1209655</guid>
      <dc:creator>guillaume_gorli</dc:creator>
      <dc:date>2021-02-13T00:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last working day vs variable Date field</title>
      <link>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782455#M1209659</link>
      <description>&lt;P&gt;You're very welcome!&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 00:38:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-working-day-vs-variable-Date-field/m-p/1782455#M1209659</guid>
      <dc:creator>Martijn_W</dc:creator>
      <dc:date>2021-02-13T00:38:55Z</dc:date>
    </item>
  </channel>
</rss>

