<?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: Next higher value available in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709617#M1063529</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. I've already tried to play around with the functions you mentioned and it works more or less. However, I think the if-loop could bring me another step further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you give me an example how a nested if-loop would look like in this case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Sep 2014 07:26:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-09-17T07:26:02Z</dc:date>
    <item>
      <title>Next higher value available</title>
      <link>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709615#M1063527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm facing an issue when trying to calculate a waiting time referring to the next higher available value...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data look as follows:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Raw Data.png" class="jive-image" src="/legacyfs/online/66865_Raw Data.png" /&gt;&lt;/P&gt;&lt;P&gt;What I now would like to calculate in QV is the waiting time per step (within one order). That means the time difference between the start date of the step I'm looking at and the end date of the previous step.&lt;/P&gt;&lt;P&gt;Problem: in case the directly previous step has no end date I would like to look at the next higher end date available (within one order).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result of the calculated waiting time should then look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Goal.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/66875_Goal.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions how to achieve this?&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 14:33:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709615#M1063527</guid>
      <dc:creator />
      <dc:date>2014-09-16T14:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Next higher value available</title>
      <link>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709616#M1063528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could calculate the Waiting Time within a resident load in which you could sort your rows per order by statement. Then you could calculate the actual row-value with the row-value from a previous row per previous() or peek().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to react by the missing values? Its difficult to say - if you have not many cases you could use peek() within a nested if-loop - if its more complex then it could be easier to remove these rows and connect these table with a key to your datamodel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 15:51:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709616#M1063528</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-09-16T15:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Next higher value available</title>
      <link>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709617#M1063529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. I've already tried to play around with the functions you mentioned and it works more or less. However, I think the if-loop could bring me another step further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you give me an example how a nested if-loop would look like in this case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 07:26:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709617#M1063529</guid>
      <dc:creator />
      <dc:date>2014-09-17T07:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Next higher value available</title>
      <link>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709618#M1063530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this, important is the correct order and that you could build a "small" logic to compare the actual row with the previous rows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(rowno() = 1 or Order &amp;lt;&amp;gt; peek('Order') or len(Start) &amp;lt; 1, '',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Start - if(len(peek('Ende', - 1)) &amp;gt;= 1, peek('Ende', - 1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(peek('Ende', - 2)) &amp;gt;= 1, peek('Ende', - 2),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(peek('Ende', - 3)) &amp;gt;= 1, peek('Ende', - 3),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(peek('Ende', - 4)) &amp;gt;= 1, peek('Ende', - 4)))))) as [Waiting Time]&lt;/P&gt;&lt;P&gt;Resident t0 order by Order, Step, Start;&lt;/P&gt;&lt;P&gt;drop table t0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively with two tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t1:&lt;/P&gt;&lt;P&gt;Load *, Order &amp;amp; '|' &amp;amp; Step as Key Resident t0 order by Order, Step, Start;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t2:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key, Order, Ende,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(Order = peek('Order'), Start - peek('Ende') as [Waiting Time]&lt;/P&gt;&lt;P&gt;Resident t1 where len(Start) &amp;gt;= 1 order by Key;&lt;/P&gt;&lt;P&gt;drop fields Order, Ende From t1;&lt;/P&gt;&lt;P&gt;drop tables t0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you will need some effort to find the correct syntax and logig but generally both approaches will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 08:01:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Next-higher-value-available/m-p/709618#M1063530</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-09-17T08:01:55Z</dc:date>
    </item>
  </channel>
</rss>

