<?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 Obtain average working hours by employee in load editor script instead of measure in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Obtain-average-working-hours-by-employee-in-load-editor-script/m-p/2430404#M96530</link>
    <description>&lt;P&gt;Hello, I currently have the following measure that does a check on the average sum of worked hours by employee regardless of date.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AvG(Aggr({&amp;lt; Weekday = {'Lu', 'Ma', 'Me', 'Gi','Ve'}, LABOR=&amp;gt;} =IF( LongShift = 0 , Sum(Duration)), Date, LABOR))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to do this in the load editor script instead, but so far I was only able to work through it with a second table that sort of messes up my model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LABOR_AGGR:
Load
    Time(LABOR_LOG_END - LABOR_LOG_START) as Duration,
    LABOR,
    Date_log as Data_Labor,
    Interval(Avg(Duration))
Resident LABOR_LOG
GROUP BY LABOR, Date_log;

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 14:35:28 GMT</pubDate>
    <dc:creator>alespooletto</dc:creator>
    <dc:date>2024-03-13T14:35:28Z</dc:date>
    <item>
      <title>Obtain average working hours by employee in load editor script instead of measure</title>
      <link>https://community.qlik.com/t5/App-Development/Obtain-average-working-hours-by-employee-in-load-editor-script/m-p/2430404#M96530</link>
      <description>&lt;P&gt;Hello, I currently have the following measure that does a check on the average sum of worked hours by employee regardless of date.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AvG(Aggr({&amp;lt; Weekday = {'Lu', 'Ma', 'Me', 'Gi','Ve'}, LABOR=&amp;gt;} =IF( LongShift = 0 , Sum(Duration)), Date, LABOR))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to do this in the load editor script instead, but so far I was only able to work through it with a second table that sort of messes up my model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LABOR_AGGR:
Load
    Time(LABOR_LOG_END - LABOR_LOG_START) as Duration,
    LABOR,
    Date_log as Data_Labor,
    Interval(Avg(Duration))
Resident LABOR_LOG
GROUP BY LABOR, Date_log;

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 14:35:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Obtain-average-working-hours-by-employee-in-load-editor-script/m-p/2430404#M96530</guid>
      <dc:creator>alespooletto</dc:creator>
      <dc:date>2024-03-13T14:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain average working hours by employee in load editor script instead of measure</title>
      <link>https://community.qlik.com/t5/App-Development/Obtain-average-working-hours-by-employee-in-load-editor-script/m-p/2430510#M96538</link>
      <description>&lt;P&gt;you may want to explore something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Load
    LABOR,
    Data_Labor,
    Duration,
    Duration/Count as Average;
Load
    sum(LABOR_LOG_END - LABOR_LOG_START) as Duration,
    count(LABOR) as Count,
    LABOR,
    Date_log as Data_Labor
Resident LABOR_LOG
WHERE LongShift = 0
GROUP BY LABOR, Date_log;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;i added the where clause to simulate what you have in your expression.&amp;nbsp; assuming Longshift is in the same table.&amp;nbsp; this returns number of days so if you need it in hours, you multiply it by 24&lt;/P&gt;
&lt;P&gt;sum(LABOR_LOG_END - LABOR_LOG_START)*24 as Duration&lt;BR /&gt;&lt;BR /&gt;you may not want to use time function&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 19:11:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Obtain-average-working-hours-by-employee-in-load-editor-script/m-p/2430510#M96538</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2024-03-13T19:11:13Z</dc:date>
    </item>
  </channel>
</rss>

