<?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: i want to find the maximum and minimum time for each ID , time taken for each id and average tim in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655238#M448188</link>
    <description>&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470" target="_self"&gt;Generic Load&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Dec 2019 17:34:46 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2019-12-08T17:34:46Z</dc:date>
    <item>
      <title>i want to find the maximum and minimum time for each ID , time taken for each id and average time</title>
      <link>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1654973#M448146</link>
      <description>&lt;P&gt;I am new to Qlikview developing and I am turning to you for some help&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;Contains 3 columns id, process stages and timestamp&lt;/P&gt;&lt;P&gt;ID PROCESS STAGES TIMESTAMP&lt;BR /&gt;1 batch submitted 29/11/2019 15:17:35&lt;BR /&gt;1 batch accepted 29/11/2019 15:18:55&lt;BR /&gt;1 batch completed 29/11/2019 15:24:59&lt;BR /&gt;2 started 02/12/2019 13:47:59&lt;BR /&gt;2 reviewCaseClaimed 02/12/2019 13:48:05&lt;BR /&gt;2 reviewCaseCompleted REJECTED 02/12/2019 14:11:39&lt;BR /&gt;2 invalidCase notifyTo 02/12/2019 14:11:41&lt;BR /&gt;3 started 02/12/2019 09:55:34&lt;BR /&gt;3 reviewCaseClaimed 02/12/2019 09:55:53&lt;BR /&gt;3 reviewCaseCompleted APPROVED 02/12/2019 09:56:05&lt;BR /&gt;3 request submitted 02/12/2019 09:56:07&lt;BR /&gt;3 returnTo 02/12/2019 10:58:27&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i want to find the maximum and minimum time for each ID , time taken for each id and average time taken.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LOAD&lt;/P&gt;&lt;P&gt;ID,&lt;BR /&gt;processstages,&lt;BR /&gt;TIMESTAMP,&lt;BR /&gt;max(timestamp(TIMESTAMP, 'DD/MM/YYYY hh:mm:ss')) as maxtime,&lt;BR /&gt;max(timestamp(TIMESTAMP, 'DD/MM/YYYY hh:mm:ss')) as mintime,&lt;BR /&gt;maxtime-mintime&lt;BR /&gt;from dataset&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;GROUP BY ID&lt;/STRONG&gt;&lt;/EM&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here I tried to get it working but failed. I tried to find the problem with this and tried some solutions given in discussions here, but couldn't make it work, would be great if someone could help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:30:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1654973#M448146</guid>
      <dc:creator>paulista</dc:creator>
      <dc:date>2024-11-16T19:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: i want to find the maximum and minimum time for each ID , time taken for each id and average tim</title>
      <link>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655098#M448177</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Welcome to Qlik !&lt;/P&gt;&lt;P&gt;first of all if I just look at the syntax, the names of the loaded fields do not exist in the data source.&lt;BR /&gt;for example "processes" to be replaced by[PROCESS TRAININGS].&lt;BR /&gt;then we don't do maxtime-mintime directly, the Qlik editor doesn't recognize these fields yet, rather choose load from "Resident".&lt;BR /&gt;and finally there is also a conceptual error at the Group By level.&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;otherwise, after a quick reading of your case, I propose the following script &amp;lt;Generic Load&amp;gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;InputTable:
LOAD * INLINE [
    ID, PROCESS STAGES, TIMESTAMP
    1,  batch submitted, 29/11/2019 15:17:35
    1,  batch accepted, 29/11/2019 15:18:55
    1,  batch completed, 29/11/2019 15:24:59
    2,  started    , 02/12/2019 13:47:59
    2,  reviewCaseClaimed, 02/12/2019 13:48:05
    2,  reviewCaseCompleted REJECTED, 02/12/2019 14:11:39
    2,  invalidCase notifyTo  , 02/12/2019 14:11:41
    3,  started    , 02/12/2019 09:55:34
    3,  reviewCaseClaimed, 02/12/2019 09:55:53
    3,  reviewCaseCompleted APPROVED, 02/12/2019 09:56:05
    3,  request submitted, 02/12/2019 09:56:07
    3,  returnTo , 02/12/2019 10:58:27
];

GenTable:
Generic Load ID, [PROCESS STAGES], timestamp(TIMESTAMP, 'DD/MM/YYYY hh:mm:ss') as TIMESTAMP Resident InputTable;

ResultTable:
LOAD Distinct ID Resident InputTable;

FOR i = 0 to NoOfTables()
  TableList:
  LOAD TableName($(i)) as Tablename AUTOGENERATE 1
  WHERE WildMatch(TableName($(i)), 'GenTable.*');
NEXT i

FOR i = 1 to FieldValueCount('Tablename')
  LET vTable = FieldValue('Tablename', $(i));
  LEFT JOIN (ResultTable) LOAD * RESIDENT [$(vTable)];
  DROP TABLE [$(vTable)];
NEXT i
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this script you can propose these visualizations :&lt;/P&gt;&lt;P&gt;1-Convert the rows into columns, with this visualization, you can display for each ID its life cycle with dates.&lt;BR /&gt;for that you make a simple table with the fields: ID,[batch submited] , ...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25088i1737677160BA0347/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2-&lt;/P&gt;&lt;P&gt;Table Min Max:&lt;BR /&gt;dimension : ID&lt;BR /&gt;measures:&lt;BR /&gt;1-Min Time&lt;/P&gt;&lt;LI-CODE lang="python"&gt;=timestamp(Min(TIMESTAMP), 'DD/MM/YYYY hh:mm:ss')&lt;/LI-CODE&gt;&lt;P&gt;2-Max Time&lt;/P&gt;&lt;LI-CODE lang="python"&gt;=timestamp(Max(TIMESTAMP), 'DD/MM/YYYY hh:mm:ss')&lt;/LI-CODE&gt;&lt;P&gt;3- Max-Min&lt;/P&gt;&lt;LI-CODE lang="python"&gt;=timestamp(timestamp(Max(TIMESTAMP), 'DD/MM/YYYY hh:mm:ss')-timestamp(Min(TIMESTAMP), 'DD/MM/YYYY hh:mm:ss'),'hh:mm:ss')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 959px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25089i261DBBFAA104B5A4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bonus, you can add the FirstSortedValue function to display the status of the Max and min&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 975px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25090iA16E7C7B2633D741/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 17:02:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655098#M448177</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2019-12-06T17:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: i want to find the maximum and minimum time for each ID , time taken for each id and average tim</title>
      <link>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655218#M448185</link>
      <description>&lt;P&gt;thanks for the solution, bonus was also quite helpful.&amp;nbsp; Can you explain how it works please.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 13:46:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655218#M448185</guid>
      <dc:creator>paulista</dc:creator>
      <dc:date>2019-12-08T13:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: i want to find the maximum and minimum time for each ID , time taken for each id and average tim</title>
      <link>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655238#M448188</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470" target="_self"&gt;Generic Load&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 17:34:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/i-want-to-find-the-maximum-and-minimum-time-for-each-ID-time/m-p/1655238#M448188</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2019-12-08T17:34:46Z</dc:date>
    </item>
  </channel>
</rss>

