<?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 Peek function used like rangesum in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Peek-function-used-like-rangesum-in-script/m-p/521374#M693238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to use the peek function in the script similar to the rangesum(above()) function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following formula in a pivot and need to transfer the same functionality to the script.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13772057380887838" jivemacro_uid="_13772057380887838" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),0,RowNo()))&amp;lt;=40,0,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),1,RowNo()))&amp;gt;40,&lt;/P&gt;
&lt;P&gt;sum(if([Hours Code]='',[Paycor Hours])),&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),1,RowNo()))&amp;lt;=40,&lt;/P&gt;
&lt;P&gt;rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),0,RowNo()))-40))))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;sum(if([Hours Code]='OT',[Paycor Hours]))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This formula is calculating Overtime over a week. I need the script to look at all the days of the previous week to current record, and then change the formula weather 40 hours has been reached. This needs to then be reset to start the process over for each new week. This will give me several fields based on each days specific row.&lt;/P&gt;&lt;P&gt;overtime&lt;/P&gt;&lt;P&gt;standard time&lt;/P&gt;&lt;P&gt;field standard time&lt;/P&gt;&lt;P&gt;field overtime&lt;/P&gt;&lt;P&gt;night premium&lt;/P&gt;&lt;P&gt;night premium overtime&lt;/P&gt;&lt;P&gt;night premium field overtime&lt;/P&gt;&lt;P&gt;night premium field overtime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the night premium is specific to the day that it was worked on, I need this function to calculate if at that time they had reach overtime or not. The final result is a summary for each employee, hence why I need this done on the script level&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 21:13:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-08-22T21:13:57Z</dc:date>
    <item>
      <title>Peek function used like rangesum in script</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-used-like-rangesum-in-script/m-p/521374#M693238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to use the peek function in the script similar to the rangesum(above()) function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following formula in a pivot and need to transfer the same functionality to the script.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13772057380887838" jivemacro_uid="_13772057380887838" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),0,RowNo()))&amp;lt;=40,0,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),1,RowNo()))&amp;gt;40,&lt;/P&gt;
&lt;P&gt;sum(if([Hours Code]='',[Paycor Hours])),&lt;/P&gt;
&lt;P&gt;if(rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),1,RowNo()))&amp;lt;=40,&lt;/P&gt;
&lt;P&gt;rangesum(above(sum(if([Hours Code]='',[Paycor Hours])),0,RowNo()))-40))))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;sum(if([Hours Code]='OT',[Paycor Hours]))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This formula is calculating Overtime over a week. I need the script to look at all the days of the previous week to current record, and then change the formula weather 40 hours has been reached. This needs to then be reset to start the process over for each new week. This will give me several fields based on each days specific row.&lt;/P&gt;&lt;P&gt;overtime&lt;/P&gt;&lt;P&gt;standard time&lt;/P&gt;&lt;P&gt;field standard time&lt;/P&gt;&lt;P&gt;field overtime&lt;/P&gt;&lt;P&gt;night premium&lt;/P&gt;&lt;P&gt;night premium overtime&lt;/P&gt;&lt;P&gt;night premium field overtime&lt;/P&gt;&lt;P&gt;night premium field overtime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the night premium is specific to the day that it was worked on, I need this function to calculate if at that time they had reach overtime or not. The final result is a summary for each employee, hence why I need this done on the script level&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 21:13:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-used-like-rangesum-in-script/m-p/521374#M693238</guid>
      <dc:creator />
      <dc:date>2013-08-22T21:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function used like rangesum in script</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-used-like-rangesum-in-script/m-p/521375#M693239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would say like above, cause the rangesum is still useful in this case.&lt;/P&gt;&lt;P&gt;Of course, you have to preapare a table properly sorted and aggregated.&lt;/P&gt;&lt;P&gt;Then create a separete field for calculating rolling sum with peek -ing the same field, reseting the accumulation each time the new week starts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Aug 2013 19:30:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-used-like-rangesum-in-script/m-p/521375#M693239</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2013-08-24T19:30:36Z</dc:date>
    </item>
  </channel>
</rss>

