<?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: Sum function in a certain amount of time in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546988#M457062</link>
    <description>&lt;P&gt;I think you should split the start and end time fields into separate fields for the data and the time:&lt;BR /&gt;Date(Floor(LatheStatistics.START_TIME)) as StartDate,&lt;BR /&gt;Time(Frac(LatheStatistics.START_TIME)) as StartTime,&lt;BR /&gt;Date(Floor(LatheStatistics.END_TIME)) as EndDate,&lt;BR /&gt;Time(Frac(LatheStatistics.END_TIME)) as EndTime,&lt;/P&gt;&lt;P&gt;That's a good idea anyway because it will use less memory that way. But you can the also easily create a marker field in &lt;A href="https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/Scripting/load-data-from-previously-loaded-table.htm#anchor-3" target="_self"&gt;a preceding load&lt;/A&gt; for those records that have a time between 6 and 21 o'clock:&lt;BR /&gt;if(StartTime&amp;gt;=6/24 and EndTime &amp;lt;21/24, 1, 0) as _Flag6To21.&lt;/P&gt;&lt;P&gt;Once you have that flag field you can use it in an expression to filter the records:&lt;BR /&gt;Sum(&lt;STRONG&gt;{&amp;lt; _Flag6To21={1}&amp;gt;} &lt;/STRONG&gt;LatheStatistics.Duration) * 24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Feb 2019 16:00:02 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2019-02-20T16:00:02Z</dc:date>
    <item>
      <title>Sum function in a certain amount of time</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546895#M457060</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everybody, &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to calculate the running time of my machines.&amp;nbsp;But I would like to sum up the production time only up to a certain time. For example, I would like to calculate the running time of the machine for the last week - but only from 6 to 21 o'clock.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I add a picture to clarify the problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently my formula is&lt;EM&gt; Sum (LatheStatistics.Duration) * 24&lt;/EM&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I calculate the total runtime, but now I would like to add only the values ​​from the right table (Sum_if) if the time is between 6 and 21 o'clock.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How should the formula be? My biggest problem is the syntax.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lathe_Stillstand_bis.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/6419iEE4E09473C6C1390/image-size/large?v=v2&amp;amp;px=999" role="button" title="Lathe_Stillstand_bis.png" alt="Lathe_Stillstand_bis.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 12:45:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546895#M457060</guid>
      <dc:creator>dominicanlauf</dc:creator>
      <dc:date>2019-02-20T12:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function in a certain amount of time</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546983#M457061</link>
      <description>&lt;P&gt;Hello Dominic,&lt;/P&gt;&lt;P&gt;I would suggest you to do 2 things:&lt;/P&gt;&lt;P&gt;In script create a flag like&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(END_TIME-floor(END_TIME)&amp;lt;=0.875 AND START_TIME-floor(START_TIME)&amp;gt;=0.25 AND END_TIME-START_TIME&amp;lt; 1,1,0) as Is_WithinTime&lt;/P&gt;&lt;P&gt;to match 6-21 interval within 1 day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In expression editor&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sum ( {&amp;lt;Is_WithinTime = {1}&amp;gt;} LatheStatistics.Duration) * 24&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;BR&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Martin&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 15:03:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546983#M457061</guid>
      <dc:creator>mato32188</dc:creator>
      <dc:date>2019-02-20T15:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function in a certain amount of time</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546988#M457062</link>
      <description>&lt;P&gt;I think you should split the start and end time fields into separate fields for the data and the time:&lt;BR /&gt;Date(Floor(LatheStatistics.START_TIME)) as StartDate,&lt;BR /&gt;Time(Frac(LatheStatistics.START_TIME)) as StartTime,&lt;BR /&gt;Date(Floor(LatheStatistics.END_TIME)) as EndDate,&lt;BR /&gt;Time(Frac(LatheStatistics.END_TIME)) as EndTime,&lt;/P&gt;&lt;P&gt;That's a good idea anyway because it will use less memory that way. But you can the also easily create a marker field in &lt;A href="https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/Scripting/load-data-from-previously-loaded-table.htm#anchor-3" target="_self"&gt;a preceding load&lt;/A&gt; for those records that have a time between 6 and 21 o'clock:&lt;BR /&gt;if(StartTime&amp;gt;=6/24 and EndTime &amp;lt;21/24, 1, 0) as _Flag6To21.&lt;/P&gt;&lt;P&gt;Once you have that flag field you can use it in an expression to filter the records:&lt;BR /&gt;Sum(&lt;STRONG&gt;{&amp;lt; _Flag6To21={1}&amp;gt;} &lt;/STRONG&gt;LatheStatistics.Duration) * 24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 16:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-in-a-certain-amount-of-time/m-p/1546988#M457062</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2019-02-20T16:00:02Z</dc:date>
    </item>
  </channel>
</rss>

