<?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 Compare expression in calculated rangesum in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063679#M930192</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;I want to calculate a cumulative sum, but I really do not find the way it works. Each record represents an event of a bus which arrives at a given station for a given time and it says when the next departure of this bus is. For each timestamp a bus arrives, i want to know, how many busses already stand at this station. So my approach is to use a RangeSum to count all arrivals before the actual arrival-timestamp and subtract the count of the next departures which are also before the actual arrival-timestamp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I have the following records&lt;/P&gt;&lt;P&gt;Id, Arrival, NextDepartue, Station&lt;/P&gt;&lt;P&gt;1, 13:05, 13:05, A&lt;/P&gt;&lt;P&gt;2, 13:40, 18:16, A&lt;/P&gt;&lt;P&gt;3, 16:20, 17:05, A&lt;/P&gt;&lt;P&gt;4, 17:00, 17:00, A&lt;/P&gt;&lt;P&gt;5, 18:30, 18:35, A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before arrival of bus with Id 1 there are 0 busses at the station A,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 2 there are 0 busses too because bus with Id 1 leaves directly,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 3 there is 1 bus because bus with Id 2 leaves at 18:16,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 4 there are 2 busses because bus with Id 2 leaves at 18:16 and bus with Id 3 leaves at 17:05,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 5, there are 0 busses at station A because all other busses already left.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: is there any possibility to compare the expression in a rangesum with the actual line, which is not part of the rangesum? I have tried something like the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Rangesum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Arrival&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 1, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RowNo&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;() - 1)) - &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Rangesum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;SPAN style="color: #800000;"&gt;NextDeparture &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt; Arrival"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NextDepartue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 1, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RowNo&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;() - 1)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And in the Set Analysis I want to compare each value of NextDeparture of the above records with the value of arrival of the actual record(which is not part of the rangesum!), but I think it does not work as desired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help? Maybe with a different approach?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Compare expression in calculated rangesum</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063679#M930192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;I want to calculate a cumulative sum, but I really do not find the way it works. Each record represents an event of a bus which arrives at a given station for a given time and it says when the next departure of this bus is. For each timestamp a bus arrives, i want to know, how many busses already stand at this station. So my approach is to use a RangeSum to count all arrivals before the actual arrival-timestamp and subtract the count of the next departures which are also before the actual arrival-timestamp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I have the following records&lt;/P&gt;&lt;P&gt;Id, Arrival, NextDepartue, Station&lt;/P&gt;&lt;P&gt;1, 13:05, 13:05, A&lt;/P&gt;&lt;P&gt;2, 13:40, 18:16, A&lt;/P&gt;&lt;P&gt;3, 16:20, 17:05, A&lt;/P&gt;&lt;P&gt;4, 17:00, 17:00, A&lt;/P&gt;&lt;P&gt;5, 18:30, 18:35, A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before arrival of bus with Id 1 there are 0 busses at the station A,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 2 there are 0 busses too because bus with Id 1 leaves directly,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 3 there is 1 bus because bus with Id 2 leaves at 18:16,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 4 there are 2 busses because bus with Id 2 leaves at 18:16 and bus with Id 3 leaves at 17:05,&lt;/P&gt;&lt;P&gt;before arrival of bus with Id 5, there are 0 busses at station A because all other busses already left.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: is there any possibility to compare the expression in a rangesum with the actual line, which is not part of the rangesum? I have tried something like the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Rangesum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Arrival&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 1, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RowNo&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;() - 1)) - &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Rangesum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;SPAN style="color: #800000;"&gt;NextDeparture &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt; Arrival"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NextDepartue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 1, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RowNo&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;() - 1)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And in the Set Analysis I want to compare each value of NextDeparture of the above records with the value of arrival of the actual record(which is not part of the rangesum!), but I think it does not work as desired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help? Maybe with a different approach?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063679#M930192</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare expression in calculated rangesum</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063680#M930193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2016 11:45:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063680#M930193</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-14T11:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare expression in calculated rangesum</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063681#M930194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not have the idea to calculate the sum in the datamodel. Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2016 12:05:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-expression-in-calculated-rangesum/m-p/1063681#M930194</guid>
      <dc:creator />
      <dc:date>2016-03-14T12:05:37Z</dc:date>
    </item>
  </channel>
</rss>

