<?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: Find a date before an N event in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505663#M44087</link>
    <description>&lt;P&gt;May be what I should do is to put the restriction when loading the data from the db i.e. TET should be&amp;nbsp; no more than Departure&amp;nbsp; + 1 day. And then, use your formula.&lt;/P&gt;&lt;P&gt;I guess the steps are to:&lt;/P&gt;&lt;P&gt;1. Load move&lt;/P&gt;&lt;P&gt;2. Load vessel&lt;/P&gt;&lt;P&gt;3. Create a new move table where TET &amp;lt; departure + 1 day&lt;/P&gt;&lt;P&gt;4. Use your formula&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But on the second thought, it will be the same load.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Nov 2018 04:41:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-14T04:41:20Z</dc:date>
    <item>
      <title>Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505583#M44076</link>
      <description>&lt;P&gt;Good day All,&lt;/P&gt;&lt;P&gt;It's good to have Qlik back. I have not realized until this downtime that all the discussion is happening here.&lt;/P&gt;&lt;P&gt;Situation: I have a col in one table - Estimated departure. I have a move col&amp;nbsp; in another table. The dates in the move col could be &amp;lt; or &amp;gt;= than the Estimated departure date. I need to find the next datetime to Estimated departure.&lt;/P&gt;&lt;P&gt;For example, the departure time is 11/13/2018 05:00 AM. The move col contains: 11/14/2018 04:00 AM; 11/14 02:00AM; 11/13/2018 06:AM; 11/13/2018 04:45 AM; 11/13/2018 03:00 AM. I want it to return 11/13/2018 04:45 AM.&lt;/P&gt;&lt;P&gt;The below piece worked just fine with IFs until yesterday when I got cases of dates being 35 values away from the Departure date.... So, there should be another way.&lt;/P&gt;&lt;P&gt;I found different posts on how to find the closest date, but nothing seems to be suitable for my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Eka&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 21:54:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505583#M44076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T21:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505588#M44077</link>
      <description>&lt;P&gt;As you&amp;nbsp; know, behind the scene, any time stamp is a number.&lt;/P&gt;&lt;P&gt;For example the time stamp "9/11/2018 12:34:46" is the number 43413.524143519.&lt;/P&gt;&lt;P&gt;Maybe you can use your move times, minus Estimated departure and then find out the minimum difference.&lt;/P&gt;&lt;P&gt;For example the departure time (with the date format D/MM/YYYY) in number format is:&amp;nbsp;num('13/11/2018 05:00:00')=43417.208333333.&lt;/P&gt;&lt;P&gt;The difference with 11/13/2018 04:45 AM is num('13/11/2018 04:45:00')=43417.197916667-43417.208333333=-0.010416666.&lt;/P&gt;&lt;P&gt;The difference with 11/13/2018 03:00 AM is num('13/11/2018 03:00:00')=43417.125-43417.208333333=-0.083333333.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression is something like this:&lt;/P&gt;&lt;P&gt;min(fabs(num(MoveColTimeStamp)-num(DepartureTime)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you understand what I am talking about...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fei&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 01:54:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505588#M44077</guid>
      <dc:creator>NZFei</dc:creator>
      <dc:date>2018-11-14T01:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505591#M44078</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for the response! How will it work? I imagine in the&amp;nbsp;non-Qlik world: loop through the entire move col and find the date where&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;min(fabs(num(MoveColTimeStamp)-num(DepartureTime)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is minimum. I don't know how to do it practically )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 02:01:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505591#M44078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T02:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505595#M44079</link>
      <description>&lt;P&gt;When you mentioned "two tables", are they the tables in QlikView script? How do they look like?&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;SomeID,&lt;/P&gt;&lt;P&gt;DepartureTime&lt;/P&gt;&lt;P&gt;From somewhere;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;SomeID,&lt;/P&gt;&lt;P&gt;MoveTime&lt;/P&gt;&lt;P&gt;From Somewhere2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 02:10:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505595#M44079</guid>
      <dc:creator>NZFei</dc:creator>
      <dc:date>2018-11-14T02:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505601#M44080</link>
      <description>&lt;P&gt;Table 1 with the vessel information where 1 vessel has 1 date:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q_1.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/33iA8A42D00D010E708/image-size/large?v=v2&amp;amp;px=999" role="button" title="q_1.png" alt="q_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table 2&amp;nbsp; with the move information where 1 crane working for 1 vessel can make several moves.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q_2.png" style="width: 427px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/34iE329D73E4DECCECE/image-size/large?v=v2&amp;amp;px=999" role="button" title="q_2.png" alt="q_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As of now I am grouping by the Vessel &amp;amp; Crane (see my piece) and use Ifs to find the closest date.&lt;/P&gt;&lt;P&gt;So, what I need to do is to find the MAX time for every crane (!) working on a particular vessel that is &amp;lt; Est Departure date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 02:26:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505601#M44080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T02:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505607#M44081</link>
      <description>&lt;P&gt;OK so for table 1 the key fields are vesslID and departure time.&lt;/P&gt;&lt;P&gt;For table 2, the key fields are vesslID, Crane and Move time. One vesslID may have many lines.&lt;/P&gt;&lt;P&gt;I don't understand what you mean by "&amp;nbsp;the MAX time for every crane (!) working on a particular vessel that is &amp;lt; Est Departure date". Can you please explain using some examples?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 02:27:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505607#M44081</guid>
      <dc:creator>NZFei</dc:creator>
      <dc:date>2018-11-14T02:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505615#M44082</link>
      <description>&lt;P&gt;Sure. In the example below we got five vessels. Let's take the one in yellow as an example.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q_6.png" style="width: 635px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36i8B9F1741D250905B/image-size/large?v=v2&amp;amp;px=999" role="button" title="q_6.png" alt="q_6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;From the move table, you see that only one crane worked for our chosen vessel - but there could be up to 8 cranes working on 1 vessel.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q_7.png" style="width: 504px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/37iFEA387588E5AAC8F/image-size/large?v=v2&amp;amp;px=999" role="button" title="q_7.png" alt="q_7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I need is to get something like a table below which shows Vessel name, crane and min and Max time.&lt;/P&gt;&lt;P&gt;Max time should be &amp;lt; than the Departure time. And obviously, the departure time will be different for different vessels but the same for all cranes working on that vessel.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q_8.png" style="width: 662px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38i5BB4C7E8ECC615AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="q_8.png" alt="q_8.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 02:37:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505615#M44082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T02:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505628#M44083</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;VESSEL_VISIT_C,&lt;/P&gt;&lt;P&gt;NUM(EST_DPTR_D) AS EST_DPTR_D&lt;/P&gt;&lt;P&gt;FROM Table 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;left join (Temp)&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;VESSEL_VISIT_C,&lt;/P&gt;&lt;P&gt;CRANE,&lt;/P&gt;&lt;P&gt;NUM(TET) AS TET&lt;/P&gt;&lt;P&gt;FROM Table 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By here you should have the data like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="TableTemp.PNG" style="width: 362px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/41iC9B99455E563FA1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TableTemp.PNG" alt="TableTemp.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Continue the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;Final:&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;load&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#800000"&gt;VESSEL_VISIT_C&lt;/FONT&gt;,&lt;BR /&gt;&lt;FONT color="#800000"&gt;CRANE&lt;/FONT&gt;,&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;Timestamp&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;min&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;TET&lt;/FONT&gt;)) &lt;FONT color="#0000ff"&gt;as&lt;/FONT&gt; &lt;FONT color="#800000"&gt;Min&lt;/FONT&gt;,&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;Timestamp&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;max&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;TET&lt;/FONT&gt;)) &lt;FONT color="#0000ff"&gt;as&lt;/FONT&gt; &lt;FONT color="#800000"&gt;Max&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;Resident&lt;/FONT&gt; Temp&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;where&lt;/FONT&gt; &lt;FONT color="#800000"&gt;TET&lt;/FONT&gt;&amp;lt;&lt;FONT color="#800000"&gt;EST_DPTR_D&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;Group&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;by&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800000"&gt;VESSEL_VISIT_C&lt;/FONT&gt;,&lt;BR /&gt;&lt;FONT color="#800000"&gt;CRANE&lt;/FONT&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;DROP&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff"&gt;Table&lt;/FONT&gt; Temp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;You will have the result you want:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="TableFinal.PNG" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/42i5941D0D80AE48103/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TableFinal.PNG" alt="TableFinal.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 03:08:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505628#M44083</guid>
      <dc:creator>NZFei</dc:creator>
      <dc:date>2018-11-14T03:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505630#M44084</link>
      <description>&lt;P&gt;The result looks what is expected! Thank you! Let me try!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 03:11:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505630#M44084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T03:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505657#M44085</link>
      <description>&lt;P&gt;My feedback s far - it's good but&amp;nbsp; it seems to be slow i.e. I am loading just a one-month sample with 150,000 rows. It has been already 10 minutes on the move table.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 04:22:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505657#M44085</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T04:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505659#M44086</link>
      <description>&lt;P&gt;My feedback s far - it's good but it seems to be slow i.e. I am loading just a one-month sample with 150,000 rows. It has been already 10 minutes on the move table.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 04:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505659#M44086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T04:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505663#M44087</link>
      <description>&lt;P&gt;May be what I should do is to put the restriction when loading the data from the db i.e. TET should be&amp;nbsp; no more than Departure&amp;nbsp; + 1 day. And then, use your formula.&lt;/P&gt;&lt;P&gt;I guess the steps are to:&lt;/P&gt;&lt;P&gt;1. Load move&lt;/P&gt;&lt;P&gt;2. Load vessel&lt;/P&gt;&lt;P&gt;3. Create a new move table where TET &amp;lt; departure + 1 day&lt;/P&gt;&lt;P&gt;4. Use your formula&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But on the second thought, it will be the same load.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 04:41:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1505663#M44087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-14T04:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Find a date before an N event</title>
      <link>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1506593#M44088</link>
      <description>&lt;P&gt;If what you mean is this part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;left join (Temp)&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;VESSEL_VISIT_C,&lt;/P&gt;&lt;P&gt;CRANE,&lt;/P&gt;&lt;P&gt;NUM(TET) AS TET&lt;/P&gt;&lt;P&gt;FROM Table 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I can't help with it as it is just a very straight load. Setting some "Where" clause when loading from the database should help...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fei&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 19:31:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Find-a-date-before-an-N-event/m-p/1506593#M44088</guid>
      <dc:creator>NZFei</dc:creator>
      <dc:date>2018-11-14T19:31:13Z</dc:date>
    </item>
  </channel>
</rss>

