<?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: Min value in date in script in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/Min-value-in-date-in-script/m-p/2000855#M23659</link>
    <description>&lt;P&gt;I think you should group by&amp;nbsp;NR_CLIENT not by&amp;nbsp;&amp;nbsp;NR_SEQUENCE&lt;/P&gt;
&lt;P&gt;// test data&lt;BR /&gt;MIN_REGIST_1:&lt;BR /&gt;LOAD&lt;BR /&gt;CEIL(RAND()*10) as NR_CLIENT,&lt;BR /&gt;ROWNO() as NR_SEQUENCE,&lt;BR /&gt;DATE(MAKEDATE(2020) + FLOOR(RAND()*365)) AS DT_REGISTRY&lt;BR /&gt;AutoGenerate 100;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// group by client and get the min by client;&amp;nbsp; join by client and dt_registry to MIN_REGIST_1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LEFT JOIN (MIN_REGIST_1)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NR_CLIENT,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MIN(DT_REGISTRY) AS DT_REGISTRY,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1 AS FL_DT_REGISTRY_MIN&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;RESIDENT MIN_REGIST_1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;GROUP BY NR_CLIENT;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2022 19:27:17 GMT</pubDate>
    <dc:creator>maxgro</dc:creator>
    <dc:date>2022-11-04T19:27:17Z</dc:date>
    <item>
      <title>Min value in date in script</title>
      <link>https://community.qlik.com/t5/Management-Governance/Min-value-in-date-in-script/m-p/2000719#M23657</link>
      <description>&lt;P&gt;Hi everyone, I have a question for a while. I have the following situation. get the first accurate record date from the customer in my table, well, for that I loaded it first,&lt;BR /&gt;the table where I have all the records and to get the min of this date, create the following transformation:&lt;BR /&gt;The NR_CLIENT fields contain the unique code of each customer, the NR_sequence field contains a table primary key with the sequence of records and the dt_registry field the date of the record when the customer entered the system.&lt;/P&gt;
&lt;P&gt;The problem is that it is marking all dates in the table as the first date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MIN_REGIST_1:
LOAD NR_CLIENT,
	 NR_SEQUENCE,
	 DT_REGISTRY
RESIDENT CLIENT_TABLE;



MIN_REGIST_2:
LOAD NR_CLIENT,
	 NR_SEQUENCE,
	 TIMESTAMP(MIN(DT_REGISTRY)) AS DT_REGISTRY_MIN,
	 'S'							AS FL_DT_REGISTRY_MIN
RESIDENT MIN_REGIST_1
Group BY NR_CLIENT,NR_SEQUENCE;



LEFT JOIN(CLIENTS) 
LOAD NR_SEQUENCE,
	 DT_REGISTRY_MIN ,
	 FFL_DT_REGISTRY_MIN
Resident MIN_REGIST_2;

DROP TABLES MIN_REGIST_1,MIN_REGIST_2 ;&lt;/LI-CODE&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;</description>
      <pubDate>Fri, 04 Nov 2022 14:05:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Min-value-in-date-in-script/m-p/2000719#M23657</guid>
      <dc:creator>lucasx15</dc:creator>
      <dc:date>2022-11-04T14:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Min value in date in script</title>
      <link>https://community.qlik.com/t5/Management-Governance/Min-value-in-date-in-script/m-p/2000855#M23659</link>
      <description>&lt;P&gt;I think you should group by&amp;nbsp;NR_CLIENT not by&amp;nbsp;&amp;nbsp;NR_SEQUENCE&lt;/P&gt;
&lt;P&gt;// test data&lt;BR /&gt;MIN_REGIST_1:&lt;BR /&gt;LOAD&lt;BR /&gt;CEIL(RAND()*10) as NR_CLIENT,&lt;BR /&gt;ROWNO() as NR_SEQUENCE,&lt;BR /&gt;DATE(MAKEDATE(2020) + FLOOR(RAND()*365)) AS DT_REGISTRY&lt;BR /&gt;AutoGenerate 100;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// group by client and get the min by client;&amp;nbsp; join by client and dt_registry to MIN_REGIST_1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LEFT JOIN (MIN_REGIST_1)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NR_CLIENT,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;MIN(DT_REGISTRY) AS DT_REGISTRY,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1 AS FL_DT_REGISTRY_MIN&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;RESIDENT MIN_REGIST_1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;GROUP BY NR_CLIENT;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 19:27:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Min-value-in-date-in-script/m-p/2000855#M23659</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2022-11-04T19:27:17Z</dc:date>
    </item>
  </channel>
</rss>

