<?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 sumifs with timestamps, in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sumifs-with-timestamps-in-script/m-p/1054907#M353720</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have browsed through a lot of posts about sum if scripting/set analysis, also tried some of the answers given, though I cannot make my specific case work, therefore I am posting my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have multiple data sets (see underneath) which give timestamps of train trips. locomotive number and KwH usage and I need to have the sum of KwH usage per TRAINRUN_ID. Now there are two key variables/conditions: &lt;STRONG&gt;Loco &lt;/STRONG&gt;and &lt;STRONG&gt;Timestamps arrival - Timestamps departure&lt;/STRONG&gt;. I need to divide the KwH usage based on these conditions -&amp;gt; = Loco Number and that the DateTime is in between the above timestamps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min_Max_Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Load&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRAINRUN_ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min_Timestamp_Departure,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max_Timestamp_Arrival&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EBIS_TRS&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRAINRUN_ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right join(EBIS_TRSB)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOC:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load TRSB_ID,&amp;nbsp;&amp;nbsp;&amp;nbsp; (TRSB is eventually coupled with a TRAIN_ID like in the previous table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOC_NO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Electricity:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOC,&lt;/P&gt;&lt;P&gt;DateTime,&lt;/P&gt;&lt;P&gt;KwH_Usage_Postive,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to divide based on the LOC number because that number is coupled with a TRAINRUN_ID. I tried to do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(If(DateTime&amp;gt;=Min_Timestamp_Departure and DateTime&amp;lt;=Max_Timestamp_Arrival and LOC = LOC_NO , KwH_Usage_Postive , 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously this did not work, maybe I have to use something else than a sumifs formula, please help me &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Feb 2016 15:10:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-02-17T15:10:20Z</dc:date>
    <item>
      <title>sumifs with timestamps, in script</title>
      <link>https://community.qlik.com/t5/QlikView/sumifs-with-timestamps-in-script/m-p/1054907#M353720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have browsed through a lot of posts about sum if scripting/set analysis, also tried some of the answers given, though I cannot make my specific case work, therefore I am posting my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have multiple data sets (see underneath) which give timestamps of train trips. locomotive number and KwH usage and I need to have the sum of KwH usage per TRAINRUN_ID. Now there are two key variables/conditions: &lt;STRONG&gt;Loco &lt;/STRONG&gt;and &lt;STRONG&gt;Timestamps arrival - Timestamps departure&lt;/STRONG&gt;. I need to divide the KwH usage based on these conditions -&amp;gt; = Loco Number and that the DateTime is in between the above timestamps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min_Max_Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Load&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRAINRUN_ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min_Timestamp_Departure,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max_Timestamp_Arrival&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EBIS_TRS&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRAINRUN_ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right join(EBIS_TRSB)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOC:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load TRSB_ID,&amp;nbsp;&amp;nbsp;&amp;nbsp; (TRSB is eventually coupled with a TRAIN_ID like in the previous table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOC_NO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Electricity:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOC,&lt;/P&gt;&lt;P&gt;DateTime,&lt;/P&gt;&lt;P&gt;KwH_Usage_Postive,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to divide based on the LOC number because that number is coupled with a TRAINRUN_ID. I tried to do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(If(DateTime&amp;gt;=Min_Timestamp_Departure and DateTime&amp;lt;=Max_Timestamp_Arrival and LOC = LOC_NO , KwH_Usage_Postive , 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously this did not work, maybe I have to use something else than a sumifs formula, please help me &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 15:10:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sumifs-with-timestamps-in-script/m-p/1054907#M353720</guid>
      <dc:creator />
      <dc:date>2016-02-17T15:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: sumifs with timestamps, in script</title>
      <link>https://community.qlik.com/t5/QlikView/sumifs-with-timestamps-in-script/m-p/1054908#M353721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest that you upload a sample qvw containing some representative data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2016 07:37:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sumifs-with-timestamps-in-script/m-p/1054908#M353721</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-02-18T07:37:08Z</dc:date>
    </item>
  </channel>
</rss>

