<?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 Sum in the script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178883#M45934</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ales,&lt;/P&gt;&lt;P&gt;You can use GROUP BY just like in SQL. Here is how your code might look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Detail:&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; Month( %dateTime ) AS [Month];&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; timestamp( timestamp#( Date, 'M/D/YYYY hh:mm:ss tt' ) ) AS %dateTime;&lt;BR /&gt;&lt;BR /&gt;SQL SELECT&lt;BR /&gt; Date,&lt;BR /&gt; EmployeeCode,&lt;BR /&gt; HoursWorked&lt;BR /&gt;FROM&lt;BR /&gt; Employer2003.dbo."Vw_WorkedHoursAttendance"&lt;BR /&gt;WHERE&lt;BR /&gt; Date&amp;gt;= '2008-01-01';&lt;BR /&gt;&lt;BR /&gt;HoursByMonth:&lt;BR /&gt;LOAD&lt;BR /&gt; [Month],&lt;BR /&gt; EmployeeCode,&lt;BR /&gt; sum( HoursWorked )&lt;BR /&gt;RESIDENT&lt;BR /&gt; Detail&lt;BR /&gt;GROUP BY&lt;BR /&gt; [Month],&lt;BR /&gt; EmployeeCode;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You might, however, want to group by both month and year so you can load more than one year's worth of data.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Hellmar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Sep 2009 19:38:51 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-09-08T19:38:51Z</dc:date>
    <item>
      <title>Sum in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178882#M45933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;please, give a small advice for a beginner and qlikview-selflerner.&lt;/P&gt;&lt;P&gt;I would like to make a sum in the script, where I load data about employees and their working hours. And my target is to have a &lt;STRONG&gt;monthly sum of HoursWorked for each Employee&lt;/STRONG&gt; . I can't figure out, how to do it, also my date is comming in "m/d/yyyy 12:00:00 AM" format. Database have records for every employee (EmployeeCode) of every day and I need to have a sum on sript level.&lt;/P&gt;&lt;P&gt;part of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;B&gt;LOAD&lt;/B&gt; Date,&lt;BR /&gt;Month(Timestamp(Date,'YYYY-MM-DD hh:mm:ss ')) &lt;B&gt;as&lt;/B&gt; Month,&lt;BR /&gt;EmployeeCode,&lt;BR /&gt;HoursWorked;&lt;BR /&gt;&lt;B&gt;SQL&lt;/B&gt; &lt;B&gt;SELECT&lt;/B&gt; Date,&lt;BR /&gt;EmployeeCode,&lt;BR /&gt;HoursWorked&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;FROM&lt;/B&gt; Employer2003.dbo."Vw_WorkedHoursAttendance"&lt;BR /&gt;where Date&amp;gt;= '2008-01-01';&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you very much for answers&lt;/P&gt;&lt;P&gt;Ales&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 18:44:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178882#M45933</guid>
      <dc:creator />
      <dc:date>2009-09-08T18:44:38Z</dc:date>
    </item>
    <item>
      <title>Sum in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178883#M45934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ales,&lt;/P&gt;&lt;P&gt;You can use GROUP BY just like in SQL. Here is how your code might look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Detail:&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; Month( %dateTime ) AS [Month];&lt;BR /&gt;&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; timestamp( timestamp#( Date, 'M/D/YYYY hh:mm:ss tt' ) ) AS %dateTime;&lt;BR /&gt;&lt;BR /&gt;SQL SELECT&lt;BR /&gt; Date,&lt;BR /&gt; EmployeeCode,&lt;BR /&gt; HoursWorked&lt;BR /&gt;FROM&lt;BR /&gt; Employer2003.dbo."Vw_WorkedHoursAttendance"&lt;BR /&gt;WHERE&lt;BR /&gt; Date&amp;gt;= '2008-01-01';&lt;BR /&gt;&lt;BR /&gt;HoursByMonth:&lt;BR /&gt;LOAD&lt;BR /&gt; [Month],&lt;BR /&gt; EmployeeCode,&lt;BR /&gt; sum( HoursWorked )&lt;BR /&gt;RESIDENT&lt;BR /&gt; Detail&lt;BR /&gt;GROUP BY&lt;BR /&gt; [Month],&lt;BR /&gt; EmployeeCode;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You might, however, want to group by both month and year so you can load more than one year's worth of data.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Hellmar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 19:38:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178883#M45934</guid>
      <dc:creator />
      <dc:date>2009-09-08T19:38:51Z</dc:date>
    </item>
    <item>
      <title>Sum in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178884#M45935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If i'm correct, there is no need to sum at script level for your purpose.&lt;BR /&gt;You can load the data as it is from the table, and during presenting the data in&lt;BR /&gt;front end, you can get it summed on a monthy basis.&lt;BR /&gt;&lt;BR /&gt;Whenever date is coming into play, its always better to create a calendar and relate&lt;BR /&gt;it with the table in which date is present.&lt;BR /&gt;&lt;BR /&gt;Refer the attached qvw file, which i think serves your purpose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 22:05:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178884#M45935</guid>
      <dc:creator />
      <dc:date>2009-09-08T22:05:01Z</dc:date>
    </item>
    <item>
      <title>Sum in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178885#M45936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Hellmar, it helped me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 15:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-in-the-script/m-p/178885#M45936</guid>
      <dc:creator />
      <dc:date>2009-09-09T15:20:33Z</dc:date>
    </item>
  </channel>
</rss>

